0
0
Dockerdevops~10 mins

Container states (created, running, paused, stopped) in Docker - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Container states (created, running, paused, stopped)
Container Created
Container Running
Paused
Running
A container starts in 'created' state, then moves to 'running'. It can be paused and resumed back to running, or stopped to end.
Execution Sample
Docker
docker create alpine
docker start <container>
docker pause <container>
docker unpause <container>
docker stop <container>
Shows commands to create, start, pause, unpause, and stop a Docker container, changing its state step-by-step.
Process Table
StepCommandContainer State BeforeActionContainer State After
1docker create alpinenoneCreate containercreated
2docker start <container>createdStart containerrunning
3docker pause <container>runningPause containerpaused
4docker unpause <container>pausedResume containerrunning
5docker stop <container>runningStop containerstopped
💡 Container stopped, no further state changes without restart or removal.
Status Tracker
Container StateStartAfter Step 1After Step 2After Step 3After Step 4After Step 5
statenonecreatedrunningpausedrunningstopped
Key Moments - 3 Insights
Why can't we pause a container that is not running?
Because only a running container can be paused, as shown in step 3 where the state changes from running to paused. Pausing a non-running container is invalid.
What happens if we try to start a container that is already running?
Starting a running container has no effect; the state remains running as shown between steps 2 and 3.
Can a stopped container be resumed directly?
No, a stopped container must be started again to become running; unpause only works from paused state, not stopped.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the container state after step 3?
Apaused
Brunning
Cstopped
Dcreated
💡 Hint
Check the 'Container State After' column for step 3 in the execution table.
At which step does the container state change back to running after being paused?
AStep 5
BStep 2
CStep 4
DStep 1
💡 Hint
Look for the 'unpause' command and its effect in the execution table.
If we skip the pause command, what would be the container state after step 4?
Apaused
Brunning
Ccreated
Dstopped
💡 Hint
Refer to the variable_tracker to see state changes without pausing.
Concept Snapshot
Docker container states:
- created: container exists but not running
- running: container is active
- paused: container temporarily frozen
- stopped: container halted
Use 'docker start', 'pause', 'unpause', 'stop' to change states.
Full Transcript
This visual execution shows how Docker container states change step-by-step. First, a container is created (state: created). Then it is started and becomes running. From running, it can be paused, freezing its processes. Unpausing resumes running. Finally, stopping the container ends it, moving to stopped state. Each command changes the container state as shown in the execution table and variable tracker. Understanding these states helps manage container lifecycle effectively.