The-Ramadhan

Dockerfile

Dockerfile is a text file that describe step to build an image.

It defines the base image, install dependency, copy application code, and set metadata that will define container behavior.

All line in Dockerfile follow the format <INSTRUCTION> <arguments>. Its common to write instruction name in all caps for clarity. Comment can be added by adding # to the start of the line.

Some instruction create layer. That is instruction that add contents. For example

  • FROM
  • COPY
  • ADD
  • RUN
  • WORKDIR

Some instruction just add metadata:

  • ENV
  • LABEL
  • EXPOSE
  • CMD
  • ENTRYPOINT
  • VOLUME