Docker
/Intermediate
Container Lifecycle
Definition
The various states a Docker container goes through from its creation to its destruction: Created, Running, Paused, Stopped (Exited), and Deleted.
Explain Like I'm New
A container is born, it does its job, it goes to sleep, and eventually, you throw it in the trash.
Real World Example
You use `docker run` (Created -> Running). You finish testing your code and type `docker stop` (Running -> Exited). The container is dead, but it still takes up hard drive space. You type `docker rm` to permanently delete it (Deleted).
Common Use Cases
- •Troubleshooting
- •Resource management
Interview Questions
basic
- Does stopping a container using `docker stop` permanently delete the container and its data?
intermediate
- What is the difference between a container in the 'Paused' state and one in the 'Stopped' state?