If you look at the Dockerfile reference, some instructions might seem overlapping at first glance, or sometimes even redundant. For example, both ADD and COPY copy new files or directories to the filesystem of the container.

In this article, I’ll explain the difference between the even more confusing instructions CMD and ENTRYPOINT.

Let’s suppose we want to create an Ubuntu image whose only purpose is to run a sleep command when it starts. We’ll create our own image and specify a new command:

FROM ubuntu
CMD sleep 10

#software-development #docker #programming #devops #containers

Difference Between CMD and ENTRYPOINT in a Dockerfile
1.25 GEEK