Your cart is currently empty!
Docker: ENTRYPOINT vs. CMD
ENTRYPOINT is the process run when the container starts (PID 1).
CMD is the argument for the entrypoint.
When you run the container without arguments, this will execute ENTRYPOINT + CMD:
# ENTRYPOINT ["ls"] # CMD ["-l"] docker run alpine # This will run "ls -h"
When you run the container with arguments, this will execute ENTRYPOINT + arguments:
# ENTRYPOINT ["ls"] # CMD ["-h"] docker run alpine -alh # This will run "ls -alh"
When you want to override the entrypoint use the –entrypoint flag:
# ENTRYPOINT ["ls"] # CMD ["-h"] docker run --entrypoint ps alpine # This will run "ps -h"
Leave a Reply