Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the Docker run command to mount a volume as read-only.
Docker
docker run -v /host/data:/container/data[1] alpine ls /container/data Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ':rw' which mounts the volume as read-write.
Using ':r' or ':read' which are invalid suffixes.
✗ Incorrect
The ':ro' suffix mounts the volume as read-only, preventing writes inside the container.
2fill in blank
mediumComplete the Docker Compose volume definition to mount a host directory as read-only.
Docker
volumes:
data:
driver: local
driver_opts:
device: /host/data
o: [1]
type: none Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'rw' which allows writing.
Using 'read' or 'r' which are not valid mount options.
✗ Incorrect
The option 'o: ro' sets the mount to read-only in Docker Compose volume options.
3fill in blank
hardFix the error in the Docker run command to correctly mount the volume as read-only.
Docker
docker run -v /host/data:/container/data[1] alpine ls /container/data Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ':readonly' or ':read-only' which are invalid.
Using ':rw' which mounts as read-write.
✗ Incorrect
The correct suffix for read-only volume mount is ':ro'. Other variants cause errors.
4fill in blank
hardComplete the code to mount a host directory as read-only and run a container that lists its contents.
Docker
docker run -v /host/data:/container/data[1] alpine ls /container/data Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Missing ':' between host and container paths.
Using ':rw' instead of ':ro' for read-only.
✗ Incorrect
The first blank needs ':' to separate host and container paths; the second blank ':ro' sets read-only mode.
5fill in blank
hardFill both blanks to create a Docker Compose service that mounts a volume read-only and runs a command.
Docker
services:
app:
image: alpine
volumes:
- /host/data:/container/data[1]
command: ls [2] /container/data Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting ':' between paths.
Not using ':ro' for read-only volume.
Forgetting '-l' for detailed listing.
✗ Incorrect
Use ':' to separate paths, ':ro' for read-only, and '-l' to list files in long format.