Recall & Review
beginner
What does the
docker attach command do?It connects your terminal to a running container's main process, letting you see its output and interact with it directly.
Click to reveal answer
beginner
How do you find the container ID or name to attach to?
Use
docker ps to list running containers with their IDs and names.Click to reveal answer
beginner
What happens if you detach from a container using
docker attach without stopping it?The container keeps running in the background; your terminal just disconnects from it.
Click to reveal answer
intermediate
Which key sequence detaches you from a container when using
docker attach?Press Ctrl + P then Ctrl + Q to detach without stopping the container.
Click to reveal answer
beginner
Can you attach to multiple containers at the same time?
No,
docker attach connects your terminal to only one container at a time.Click to reveal answer
Which command lists running containers so you can find one to attach to?
✗ Incorrect
Use
docker ps to see running containers and their IDs or names.What does
docker attach <container> do?✗ Incorrect
docker attach connects your terminal to the main process of a running container.How do you safely detach from a container without stopping it?
✗ Incorrect
Press Ctrl + P then Ctrl + Q to detach safely.
If you exit a container's shell after attaching, what happens to the container?
✗ Incorrect
Exiting the main process usually stops the container.
Can you attach to a container that is not running?
✗ Incorrect
You can attach only to containers that are currently running.
Explain how to attach to a running Docker container and then detach without stopping it.
Think about commands to list containers, attach, and key sequences to detach.
You got /3 concepts.
Describe what happens to a container when you attach to it and then exit its main process.
Consider the difference between exiting and detaching.
You got /3 concepts.