0
0
Dockerdevops~20 mins

Volume vs bind mount decision in Docker - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Volume vs Bind Mount Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Choosing between Docker volume and bind mount for persistent data

You want to store database data persistently in Docker. Which option best explains when to use a Docker volume instead of a bind mount?

AUse a Docker volume when you want Docker to manage the data storage location and ensure portability across different hosts.
BUse a Docker volume only if you want to directly edit files on the host machine from inside the container.
CUse a bind mount when you want Docker to manage the data storage and isolate it from the host filesystem.
DUse a bind mount when you want Docker to automatically backup the data to the cloud.
Attempts:
2 left
💡 Hint

Think about who controls the data location and portability.

💻 Command Output
intermediate
1:30remaining
Output of Docker volume inspect command

What is the output type of the command docker volume inspect my_volume?

Docker
docker volume inspect my_volume
AAn error message saying the volume does not exist, even if it does.
BA JSON array with detailed information about the volume, including mountpoint and driver.
CA plain text list of files inside the volume.
DA simple string showing only the volume name.
Attempts:
2 left
💡 Hint

Think about what 'inspect' commands usually return in Docker.

🔀 Workflow
advanced
2:30remaining
Correct order to create and use a Docker volume in a container

Arrange the steps in the correct order to create a Docker volume and use it in a container.

A1,3,2,4
B3,1,2,4
C1,2,3,4
D3,2,1,4
Attempts:
2 left
💡 Hint

Think about listing volumes before and after creation, and when to remove.

Troubleshoot
advanced
2:00remaining
Troubleshooting permission issues with bind mounts

You mounted a host directory into a container using a bind mount, but the container process cannot write to the directory. What is the most likely cause?

ADocker volumes never have permission issues, so the problem is with the container image.
BThe container must be restarted twice to apply bind mount permissions.
CBind mounts automatically change permissions to allow container writes.
DThe host directory permissions do not allow the container user to write to it.
Attempts:
2 left
💡 Hint

Consider how host filesystem permissions affect bind mounts.

Best Practice
expert
3:00remaining
Best practice for sharing configuration files between host and container

You want to share configuration files between your host and a Docker container, allowing live edits on the host to reflect immediately inside the container. Which is the best approach?

ABake the configuration files into the container image and rebuild the image on every change.
BUse a Docker volume to store the configuration files and copy them manually when changed.
CUse a bind mount to link the host configuration directory to the container path.
DUse a Docker secret to store configuration files for live editing.
Attempts:
2 left
💡 Hint

Think about live updates and direct file access.