04 January 2018

docs

  1. hosting static content

    1. use cli

       docker run --name gnginx -v /some/content:/usr/share/nginx/html:ro -d nginx
      
    2. use dockerfile

       $ nano Dockerfile
       FROM nginx
       COPY static-html-directory /usr/share/nginx/html
      
       $ docker build -t some-content-nginx .
       $ docker run --name some-nginx -d some-content-nginx
      
    3. exposing external port

       $ docker run --name gnginx -d -p 8080:80 some-content-nginx
      
  2. config

    1. use config file

       $ docker -run --name gnginx -d -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -p 8080:80 some-content-nginx
      
    2. use default config file

       $ docker run --name tmp-nginx -d -p 8888:80 nginx
       $ docker cp tmp-nginx:/etc/nginx/nginx.conf /host/path/nginx.conf
       $ docker rm -f tmp-nginx
      

references

  1. nginx.org

  2. https://store.docker.com/images/nginx



blog comments powered by Disqus