Once you can run containers, you need to manage them: list what is running, stop and start them, restart automatically on failure, and remove them when done. Containers have a lifecycle — created, running, paused, stopped, removed — and managing that lifecycle is a core daily skill. Knowing the state of your containers and controlling it is essential to working with Docker beyond the simplest runs.
Docker provides a clear set of commands for this: ps to list containers, stop and start to control them, restart to bounce them, and rm to remove them. Restart policies tell Docker to automatically restart a container on failure or at boot, important for resilient services. Understanding container states and exit codes helps you diagnose why a container stopped.
This lesson covers the container lifecycle, listing and filtering containers, starting and stopping them, restart policies for resilience, and cleaning up. These commands are the bread and butter of operating containers, used constantly whether developing locally or running services.