Dockerizing Nginx Applications
1 min read
- Authors
- Name
- Vijaykumar Rajendran
- @vijayrajendran_

Table of Contents
Dockerizing Nginx Applications
Basic Dockerfile
FROM nginx:latest
COPY nginx.conf /etc/nginx/nginx.conf
COPY html /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
Build Image
docker build -t my-nginx:1.0 .
Run Container
docker run -p 80:80 my-nginx:1.0
Docker Compose
version: '3'
services:
nginx:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./html:/usr/share/nginx/html
Containerized!