If you look around at various blog posts and articles for Dockerfile information, you'll see that the Dockerfile list of options includes two methods of running an application when a container starts: ENTRYPOINT and CMD.
On first look, it seems that these two options do roughly the same thing. You can generally replace CMD with ENTRYPOINT for an image and it should work. But not always – there are some cases, such as with RabbitMQ, where replacing CMD with ENTRYPOINT would cause problems. Yet CMD can be specified to customize the way RabbitMQ starts.
So, what's the difference between ENTRYPOINT & CMD? Why have two options to run an application in a container?
This episode will explore the difference between the two options, show you how they work together and offer some advice on when you should use ENTRYPOINT vs CMD, all while showing you how it works through building your own images and containers.