What command starts a Docker container that is already created but stopped?
Use docker start <container_name_or_id> to start a stopped container.
Click to reveal answer
beginner
How do you stop a running Docker container?
Use docker stop <container_name_or_id> to stop a running container gracefully.
Click to reveal answer
intermediate
What is the difference between docker stop and docker kill?
docker stop sends a signal to stop the container gracefully, allowing cleanup. docker kill forces the container to stop immediately.
Click to reveal answer
beginner
How can you start a container and attach to its output in one command?
Use docker run to start a new container and attach to its output immediately.
Click to reveal answer
beginner
What command lists all running containers?
Use docker ps to see all running containers.
Click to reveal answer
Which command starts a stopped Docker container?
Adocker stop container_name
Bdocker start container_name
Cdocker run container_name
Ddocker kill container_name
✗ Incorrect
docker start resumes a stopped container. docker run creates and starts a new container.
What does docker stop do?
AForces immediate container shutdown
BLists all containers
CGracefully stops a running container
DStarts a new container
✗ Incorrect
docker stop sends a signal to stop the container gracefully.
How do you see all running containers?
Adocker show
Bdocker ls
Cdocker list
Ddocker ps
✗ Incorrect
docker ps lists all running containers.
Which command starts a new container and attaches to it immediately?
Adocker run
Bdocker start
Cdocker attach
Ddocker exec
✗ Incorrect
docker run creates and starts a new container and attaches to its output.
What is the effect of docker kill?
AForces immediate stop of a container
BGracefully stops a container
CStarts a container
DRemoves a container
✗ Incorrect
docker kill forces the container to stop immediately without cleanup.
Explain how to start and stop Docker containers using commands.
Think about commands to resume stopped containers and to stop running ones.
You got /4 concepts.
Describe the difference between docker stop and docker kill.
Consider how the container is stopped and if it has time to clean up.
You got /4 concepts.
Practice
(1/5)
1. Which command is used to start a container that has been stopped in Docker?
easy
A. docker run <container_name>
B. docker stop <container_name>
C. docker start <container_name>
D. docker restart <container_name>
Solution
Step 1: Understand the purpose of docker start
This command resumes a container that was previously stopped without creating a new one.
Step 2: Differentiate from other commands
docker run creates a new container, docker stop stops a running container, and docker restart stops then starts a container.
Final Answer:
docker start <container_name> -> Option C
Quick Check:
Start stopped container = docker start [OK]
Hint: Use 'docker start' to resume stopped containers fast [OK]
Common Mistakes:
Confusing 'docker run' with 'docker start'
Using 'docker stop' to start containers
Thinking 'docker restart' only starts containers
2. Which of the following is the correct syntax to stop a running Docker container named webapp?
easy
A. docker terminate webapp
B. docker kill webapp
C. docker pause webapp
D. docker stop webapp
Solution
Step 1: Identify the command to safely stop a container
docker stop sends a signal to gracefully stop the container.
Step 2: Check other options
docker kill forcefully stops, docker pause suspends, and docker terminate is invalid.
Final Answer:
docker stop webapp -> Option D
Quick Check:
Stop container safely = docker stop [OK]
Hint: Use 'docker stop' to safely end container processes [OK]
Common Mistakes:
Using 'docker kill' instead of 'docker stop'
Confusing 'docker pause' with stopping
Using non-existent commands like 'docker terminate'
3. What will be the output of the following commands if the container db is currently stopped?
docker start db
docker stop db
medium
A. Container 'db' starts, then stops successfully
B. Error: container 'db' not found
C. Container 'db' remains stopped
D. Container 'db' restarts automatically
Solution
Step 1: Analyze docker start db
This command starts the stopped container named 'db'.
Step 2: Analyze docker stop db
This command stops the running container 'db' safely.
Final Answer:
Container 'db' starts, then stops successfully -> Option A
Quick Check:
Start then stop container = success [OK]
Hint: Start then stop a container runs commands without error [OK]
Common Mistakes:
Assuming 'docker start' creates a new container
Expecting errors if container exists
Thinking container restarts automatically without command
4. You run docker start myapp but get the error: Error response from daemon: No such container: myapp. What is the most likely cause?
medium
A. Docker daemon is not running
B. The container 'myapp' does not exist
C. You need to use docker run instead
D. The container 'myapp' is already running
Solution
Step 1: Understand the error message
The error says 'No such container', meaning 'myapp' is not found in Docker's container list.
Step 2: Check other options
If it was running, 'docker start' would not error; 'docker run' creates new containers but error is about missing container; daemon not running causes different errors.
Final Answer:
The container 'myapp' does not exist -> Option B
Quick Check:
No such container error = container missing [OK]
Hint: Check container existence before starting [OK]
Common Mistakes:
Assuming container is running when error says missing
Trying 'docker run' without checking container list
Ignoring Docker daemon status
5. You want to stop a container named api-server but ensure it has 10 seconds to finish its work before stopping. Which command should you use?
hard
A. docker stop -t 10 api-server
B. docker kill -t 10 api-server
C. docker pause api-server
D. docker stop api-server -timeout 10
Solution
Step 1: Understand the timeout option in docker stop
The -t or --time flag sets seconds to wait before killing the container.
Step 2: Evaluate the options
docker kill does not support -t, docker pause only suspends, and -timeout is invalid syntax.
Final Answer:
docker stop -t 10 api-server -> Option A
Quick Check:
Stop with timeout = docker stop -t [OK]
Hint: Use 'docker stop -t seconds' to allow graceful shutdown [OK]
Common Mistakes:
Using 'docker kill' with timeout flag
Using invalid flags like '-timeout'
Confusing 'pause' with stopping
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.