Skip to content

Instantly share code, notes, and snippets.

@oliveira-andre
Created September 4, 2021 04:54
Show Gist options
  • Save oliveira-andre/b7a8dfa551d86acb9d20a51becc71cf5 to your computer and use it in GitHub Desktop.
Save oliveira-andre/b7a8dfa551d86acb9d20a51becc71cf5 to your computer and use it in GitHub Desktop.

nginx by docker

simple nginx, with same welcome page

docker run --name static-demo-page -p 80:80 -d nginx

changing welcome pages

docker run --name static-demo-page -v /var/www/html:/usr/share/nginx/html:ro -p 80:80 -d nginx

sending own configuration

write a Dockerfile

FROM nginx
RUN rm /etc/nginx/conf.d/default.conf
COPY content /usr/share/nginx/html
COPY conf /etc/nginx

build image

docker build -t mynginx_image2 .

run nginx

docker run --name mynginx4 -p 80:80 -d mynginx_image2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment