Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!
We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!
Learn from Guru Rajesh Kumar and double your salary in just one year.
5 Differences between CMD and ENTRYPOINT with example
CMD Entrypoint
- the executable command will be replaced by the command 1. The executable command can’t be changed
given while running the container - We can’t pass the arguments for the CMD command 2. The commands passed while running the container will be appended to the RUN command
- Multiple times can be added in the dockerfile 3. same as CMD
but the last line will override the previous - Choose CMD if you need to provide a default command 4. Prefer ENTRYPOINT to CMD when building executable Docker image
and/or arguments that can be overwritten from command line and you need a command always to be execute
when docker container runs - Treated as additional param when it is used 5. Always the main command
along with ENTRYPOINT