docs
-
hosting static content
-
use cli
docker run --name gnginx -v /some/content:/usr/share/nginx/html:ro -d nginx
-
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
-
exposing external port
$ docker run --name gnginx -d -p 8080:80 some-content-nginx
-
-
config
-
use config file
$ docker -run --name gnginx -d -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -p 8080:80 some-content-nginx
-
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
-