Dockerfile Best Practices

Best practices for writing Dockerfiles

FROM alpine3.12
COPY . /app
RUN make /app
CMD main

Each instruction creates one layer:

  • FROM creates a layer from the alpine 3.12 Docker image.
  • COPY adds files from your Docker client’s current directory.
  • RUN builds your application with make.
  • CMD specifies what command to run within the container.