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
CMDwill 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
ENTRYPOINTis specified,CMDparamas will be added to theENTRYPOINT -
ENTRYPOINT ["git"] CMD ["--help"]
building
{{@29#bkmrk-build-dockerfile}}Docker CLI