💻 Tech
ENTRYPOINT
is the default command when you run a Docker container. It gets appended with what’s in CMD
.
Dockerfile
ENTRYPOINT ["sleep"]
CMD ["2000"]
docker run someimage
— executessleep 2000
(uses default ENTRYPOINT + CMD)docker run someimage 5000
— executessleep 5000
(uses default ENTRYPOINT with overriden CMD)docker run someimage 3000 --entrypoint somecommand
— executssomecommand 3000
(uses overriden ENTRYPOINT and CMD)
With container used in a pod, args
overrides CMD
, and command
the ENTRYPOINT
.
containers
- name: ubuntu
image: ubuntu
args: ["10"] # overrides CMD in the docker file
command: ["somecommand"] # overrides the ENTRYPOINT in the docker file