Start Apps Using Container
Understand how Docker containers start applications by using Entrypoint and Cmd instructions or command line arguments. Learn to check image metadata for these instructions and how to control app startup behavior inside containers. Practice running containers with custom commands and managing their lifecycle using Docker CLI.
In the previous lesson, we created a container running a web app. But how did the container know which app to start and how to start it?
Different ways to start an app in a container
There are three ways we can tell Docker how to start an app in a container:
- An
Entrypointinstruction in the image - A
Cmdinstruction in the image - A CLI argument
We’ll learn more about these in the next chapter, but the Entrypoint and Cmd instructions are optional image metadata that store the command Docker uses to start the default ...