Introduction
Sometimes you want your container to run a specific command automatically when it starts. The CMD instruction in a Dockerfile sets this default command so you don't have to type it every time.
When you want your container to start a web server automatically without extra commands.
When you have a script that should run every time the container launches.
When you want to provide a default behavior but still allow users to override it.
When you build a base image that other images will extend and want a sensible default command.
When you want to simplify running containers by not typing the command manually.