Skip to content

Latest commit

 

History

History
executable file
·
25 lines (23 loc) · 602 Bytes

dockerfile_nginx_simple.md

File metadata and controls

executable file
·
25 lines (23 loc) · 602 Bytes

Dockerfile sample

Simple nginx dockerfile

FROM ubuntu:latest
LABEL maintainer="Ahmad Rafiee <[email protected]>"
RUN apt update \
    && apt install -y vim nginx

# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
    && ln -sf /dev/stderr /var/log/nginx/error.log

EXPOSE 80
    CMD ["nginx", "-g", "daemon off;"]

Build this dockerfile

docker build -t <TAG_NAME> -f <Dockerfile path> .
# For example
docker build -t nginx:test .

Run nginx image

docker run -d --name web -p 80:80 nginx:test