grdnrio
9/25/2017 - 2:54 PM

Boilerplate Dockerfile

Boilerplate Dockerfile

FROM debian:stretch-slim
# all images must have a FROM
# usually from a minimal Linux distribution like debain or (even better) alpine
# if you truly want to start with an empty container, use FROM scratch

ENV BLAH some-value
# optional environment variable that could be used in later lines and set as envvar when container is running

RUN apt-get update \
	&& apt-get install a load of software -y
	&& rm -rf /var/lib/apt/lists/*
# optional commands to run at shell inside container at build time

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

EXPOSE 80 443
# expose these ports on the docker virtual network
# you still need to use -p or -P to open/forward these ports on host

CMD ["service", "-g", "daemon off;"]
# required: run this command when container is launched
# only one CMD allowed, so if there are mulitple, last one wins