Skip to main content

Dockerfile

Dockerfile

  • dockerfile manuals:
    • https://takacsmark.com/dockerfile-tutorial-by-example-dockerfile-best-practices-2018/
  • best practice:
    • https://docs.docker.com/develop/develop-images/dockerfile_best-practices/

key instructions

  • FROM - base image
  • ENV variable=test
    • environment variable
    • can be used with bash syntax $variable
  • VOLUME [ "/var/test" ]
    • used to expose some storage
  • CMD
    • what command should be run in the image
    • CMD [“executable”, “param1”, “param2”, ...]
    • Its possible to override the command on starting up a container docker run myImage:latest _command_
    • Only last CMD will be used (so specifiy only one).
    • Its a good practice to specify at leaset a shell command here.
  • ENTRYPOINT
    • Used to specify the 'main executable' of the image
    • If ENTRYPOINT is specified, CMD paramas will be added to the ENTRYPOINT
    • ENTRYPOINT ["git"]
      CMD ["--help"]
      

building

build dockerfile