Challenge - 5 Problems
Volume Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
π» Command Output
intermediate1:30remaining
Volume Creation Command Output
What is the output of the command
docker volume create mydata when run on a system with no existing volume named mydata?Docker
docker volume create mydataAttempts:
2 left
π‘ Hint
The command returns the name of the created volume if successful.
β Incorrect
The
docker volume create command outputs the name of the newly created volume. If the volume does not exist, it creates it and prints its name.β Troubleshoot
intermediate1:30remaining
Volume Removal Error Diagnosis
You run
docker volume rm mydata but get the error: Error: volume is in use - [container_id]. What is the most likely cause?Attempts:
2 left
π‘ Hint
Volumes cannot be removed if they are used by containers.
β Incorrect
Docker prevents removal of volumes that are currently used by containers to avoid data loss or container failure.
β Configuration
advanced2:00remaining
Docker Compose Volume Configuration
In a
docker-compose.yml file, which volume configuration correctly mounts a named volume dbdata to /var/lib/mysql inside the container?Docker
version: '3.8'
services:
db:
image: mysql
volumes:Attempts:
2 left
π‘ Hint
Use the long syntax for named volumes with type volume.
β Incorrect
Option D uses the correct long syntax for named volumes in Docker Compose, specifying type, source, and target correctly.
π Workflow
advanced2:30remaining
Volume Backup and Restore Workflow
Which sequence of commands correctly backs up a Docker volume named
mydata to a tar file and then restores it?Attempts:
2 left
π‘ Hint
Use a temporary container to access volume data for backup and restore.
β Incorrect
Option B uses a temporary container with the volume mounted to create and extract a tar archive for backup and restore.
β
Best Practice
expert2:00remaining
Choosing Volume Types for Persistent Data
Which statement best describes when to use Docker named volumes instead of bind mounts for persistent data?
Attempts:
2 left
π‘ Hint
Think about who controls the data location and lifecycle.
β Incorrect
Named volumes are managed by Docker and stored in Dockerβs storage area, making them portable and easier to manage than bind mounts which directly map host directories.