Bird
Raised Fist0
Dockerdevops~20 mins

Container states (created, running, paused, stopped) in Docker - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Container States Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Identify the container state after creation
You run the command docker create nginx. What is the state of the container immediately after this command?
Acreated
Brunning
Cpaused
Dstopped
Attempts:
2 left
💡 Hint
Creating a container sets it up but does not start it.
💻 Command Output
intermediate
2:00remaining
State of container after running and pausing
You start a container with docker run -d nginx and then pause it with docker pause [container_id]. What is the container's state after pausing?
Arunning
Bcreated
Cstopped
Dpaused
Attempts:
2 left
💡 Hint
Pausing suspends the container's processes temporarily.
✅ Best Practice
advanced
2:00remaining
Choosing the correct command to stop a running container
Which command properly stops a running Docker container and changes its state to 'stopped'?
Adocker stop [container_id]
Bdocker pause [container_id]
Cdocker kill [container_id]
Ddocker rm [container_id]
Attempts:
2 left
💡 Hint
Stopping allows graceful shutdown, killing is forceful.
❓ Troubleshoot
advanced
2:00remaining
Diagnosing why a container is stuck in 'paused' state
You notice a container is stuck in the 'paused' state and does not resume with docker unpause. What is a likely cause?
AThe container was removed while paused
BDocker daemon crashed and did not restore container state
CThe container is in 'created' state, not 'paused'
DThe container was never started
Attempts:
2 left
💡 Hint
Docker daemon manages container states and may lose track after a crash.
🧠 Conceptual
expert
3:00remaining
Understanding container lifecycle transitions
Which sequence correctly represents the lifecycle states of a Docker container from creation to removal?
Acreated → paused → running → stopped → removed
Brunning → created → paused → stopped → removed
Ccreated → running → paused → running → stopped → removed
Dcreated → running → stopped → paused → removed
Attempts:
2 left
💡 Hint
Think about the order in which a container can be paused and resumed.

Practice

(1/5)
1. Which Docker container state means the container is currently executing processes?
easy
A. stopped
B. created
C. paused
D. running

Solution

  1. Step 1: Understand container states

    The 'running' state means the container is actively executing its processes.
  2. Step 2: Compare other states

    'Created' means container is made but not started, 'paused' means temporarily halted, 'stopped' means container is not running.
  3. Final Answer:

    running -> Option D
  4. Quick Check:

    Active container = running [OK]
Hint: Running means container is actively working [OK]
Common Mistakes:
  • Confusing 'created' with 'running'
  • Thinking 'paused' means running
  • Mixing 'stopped' with 'running'
2. Which command shows all Docker containers including stopped ones?
easy
A. docker ps -a
B. docker pause
C. docker start
D. docker ps

Solution

  1. Step 1: Recall docker ps usage

    'docker ps' shows only running containers by default.
  2. Step 2: Use option to show all containers

    'docker ps -a' lists all containers, including stopped and paused ones.
  3. Final Answer:

    docker ps -a -> Option A
  4. Quick Check:

    Show all containers = docker ps -a [OK]
Hint: Add -a to see all containers, not just running [OK]
Common Mistakes:
  • Using 'docker ps' alone shows only running containers
  • Confusing 'docker start' with listing containers
  • Thinking 'docker pause' lists containers
3. What is the state of the container after running these commands?
docker create nginx
docker start <container_id>
docker pause <container_id>
medium
A. paused
B. created
C. running
D. stopped

Solution

  1. Step 1: Analyze commands sequence

    'docker create' makes container in 'created' state, 'docker start' moves it to 'running'.
  2. Step 2: Effect of 'docker pause'

    'docker pause' suspends container processes without stopping it, changing state to 'paused'.
  3. Final Answer:

    paused -> Option A
  4. Quick Check:

    Pause command sets state to paused [OK]
Hint: Pause command changes running to paused state [OK]
Common Mistakes:
  • Assuming container stays running after pause
  • Confusing created with paused
  • Thinking pause stops the container
4. You ran docker pause mycontainer but got an error saying container is not running. What is the likely cause?
medium
A. Container is already paused
B. Container is stopped or not started
C. Container name is incorrect
D. Docker daemon is not running

Solution

  1. Step 1: Understand pause command requirements

    'docker pause' only works on running containers to suspend them temporarily.
  2. Step 2: Interpret error message

    Error about container not running means it is stopped or never started, so pause cannot apply.
  3. Final Answer:

    Container is stopped or not started -> Option B
  4. Quick Check:

    Pause needs running container [OK]
Hint: Pause only works on running containers [OK]
Common Mistakes:
  • Trying to pause stopped containers
  • Ignoring container state before pausing
  • Assuming pause works on any container
5. You want to temporarily stop a container without losing its state and then resume it later. Which sequence of commands should you use?
hard
A. docker kill <container_id> then docker start <container_id>
B. docker stop <container_id> then docker start <container_id>
C. docker pause <container_id> then docker unpause <container_id>
D. docker restart <container_id> then docker pause <container_id>

Solution

  1. Step 1: Understand stopping vs pausing

    'docker stop' stops container and loses running state; 'docker pause' suspends without stopping.
  2. Step 2: Identify commands to pause and resume

    'docker pause' suspends container, 'docker unpause' resumes it preserving state.
  3. Final Answer:

    docker pause & docker unpause -> Option C
  4. Quick Check:

    Pause/unpause = temporary stop and resume [OK]
Hint: Pause to stop temporarily, unpause to resume [OK]
Common Mistakes:
  • Using stop loses container state
  • Confusing kill with pause
  • Restarting instead of unpausing
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard