Recall & Review
beginner
What is a Docker volume?
A Docker volume is a storage area managed by Docker that containers can use to save and share data persistently outside the container's writable layer.
Click to reveal answer
beginner
How do you share data between two Docker containers using volumes?
You create a Docker volume and mount it into both containers at the desired path. This way, both containers can read and write to the same data location.
Click to reveal answer
beginner
What is the command to create a Docker volume named 'shared-data'?
docker volume create shared-data
Click to reveal answer
intermediate
How do you run two containers sharing the same volume 'shared-data' at path '/app/data'?
docker run -d --name container1 -v shared-data:/app/data image1
docker run -d --name container2 -v shared-data:/app/data image2
Click to reveal answer
beginner
Why is sharing volumes between containers useful?
It allows containers to share files and data easily, such as logs, configuration files, or databases, without copying data between containers or rebuilding images.
Click to reveal answer
Which Docker command creates a volume named 'data-vol'?
✗ Incorrect
The correct command to create a volume is 'docker volume create '.
How do you mount a volume named 'shared-vol' to '/data' inside a container?
✗ Incorrect
The syntax to mount a volume is '-v volume-name:container-path'.
What happens if two containers share the same Docker volume?
✗ Incorrect
Sharing a volume means both containers access the same data location.
Which of these is NOT a benefit of sharing volumes between containers?
✗ Incorrect
Sharing volumes does not handle networking between containers.
To share a volume between containers, you must:
✗ Incorrect
Sharing volumes requires creating a volume and mounting it into each container.
Explain how to share data between two Docker containers using volumes.
Think about creating a common storage space both containers can use.
You got /3 concepts.
Describe the benefits of using Docker volumes to share data between containers.
Consider why sharing data directly is better than copying files.
You got /4 concepts.