Dockerfile and its instructions

  • Name of the dockerfile can only be Dockerfile , it is casesensitive
  • Dockerfile contains instructions
  • When executed Dockerfile creates an Image
  • This image is then executed to create a runtime container

  • FROM
    • From command is used to use an existing image from the docker repository
  • RUN
    • Run command executes the command on the image
  • COPY
    • COPY command copies the 1st argument file to the image at 2nd argument location
  • WORKDIR
    • Similar to change directory in linux
  • CMD
    • Use the run the command on terminal
    • Run multiple commands
      • CMD [“catalina.sh”, “run”]
  • EXPOSE
    • Exposes a port of container
    • Example : EXPOSE 8080
  • ADD
    • Just like copy but can also copy directories
    • URL can also be provided here

Leave a Comment