Recall & Review
beginner
What is a Docker volume?
A Docker volume is a storage area outside the container's writable layer. It lets containers save and share data persistently, even if the container stops or is deleted.
Click to reveal answer
beginner
How do you create a Docker volume named
mydata?Use the command: <br>
docker volume create mydata<br>This creates a new volume called mydata that containers can use to store data.Click to reveal answer
beginner
How do you attach a volume to a container?
Use the
-v or --mount option when running a container. For example:<br>docker run -v mydata:/app/data myimage<br>This mounts the volume mydata inside the container at /app/data.Click to reveal answer
beginner
How can you list all Docker volumes on your system?
Run the command:<br>
docker volume ls<br>This shows all volumes available on your Docker host.Click to reveal answer
intermediate
How do you remove a Docker volume named
mydata?Use the command:<br>
docker volume rm mydata<br>This deletes the volume named mydata. Make sure no container is using it first.Click to reveal answer
What happens to data in a Docker volume if the container using it is deleted?
✗ Incorrect
Docker volumes store data outside the container's writable layer, so deleting a container does not delete the volume or its data.
Which command creates a new Docker volume named
backup?✗ Incorrect
The correct syntax to create a volume is
docker volume create [name].How do you mount a volume named
data to the path /var/lib/data inside a container?✗ Incorrect
The
-v option uses the syntax volume_name:container_path.Which command lists all Docker volumes?
✗ Incorrect
The correct command to list volumes is
docker volume ls.What must you do before removing a Docker volume?
✗ Incorrect
You cannot remove a volume if it is currently used by any container.
Explain how to create a Docker volume and use it in a container.
Think about commands to create and run containers with volumes.
You got /3 concepts.
Describe how to list and remove Docker volumes safely.
Consider commands and safety steps before deleting volumes.
You got /3 concepts.