Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in DevOps and Agile by (2.3k points)
I have a lot of confusion in the difference between CMD and RUN. can anyone help me out?

1 Answer

0 votes
by (6.9k points)

RUN - This is an image build step. Any changes made to the container after a RUN command will be saved in the container image created. You can have mutiple RUN commands as layers on top of each other to create the image.

CMD - It is a command that is executed when a built image is launched by default. There can be only one CMD command in a dockerfile.

ENTRYPOINT - very simillar to CMD & can be used to change how container is started from an image.


Learn more on how you can create a dockerfile and the different commands used in it and a lot more things in the docker training course.

Related questions

Browse Categories

...