Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the command to run a Docker container with a read-only filesystem.
Docker
docker run --rm -it --read-only [1] sh Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting volume mount options in place of the image name.
Forgetting to specify the image name.
✗ Incorrect
The image name 'alpine' is required to run the container. The --read-only flag makes the filesystem read-only.
2fill in blank
mediumComplete the command to mount a writable tmpfs volume inside a read-only Docker container.
Docker
docker run --rm -it --read-only --tmpfs [1] alpine sh Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mounting tmpfs on system directories like /etc which should remain read-only.
Choosing directories that are not writable by default.
✗ Incorrect
Mounting a tmpfs at /tmp allows temporary writable storage inside a read-only container.
3fill in blank
hardFix the error in the command to run a read-only container with a writable /var/log directory.
Docker
docker run --rm -it --read-only -v [1] alpine sh Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using only the container path without specifying the host path.
Reversing the host and container paths.
✗ Incorrect
To make /var/log writable, you must mount a volume from the host to /var/log inside the container.
4fill in blank
hardFill both blanks to create a read-only container with a writable /tmp and /var/cache directories.
Docker
docker run --rm -it --read-only --tmpfs [1] --tmpfs [2] alpine sh
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mounting tmpfs on directories that should remain read-only.
Using the same directory for both mounts.
✗ Incorrect
Mounting tmpfs volumes at /tmp and /var/cache allows these directories to be writable in a read-only container.
5fill in blank
hardFill all three blanks to run a read-only container with a writable /tmp, a volume mount for /var/log, and a container name.
Docker
docker run --rm -it --read-only --tmpfs [1] -v [2] --name [3] alpine sh
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing volume mount syntax.
Forgetting to specify the container name.
Using incorrect paths for tmpfs or volume mounts.
✗ Incorrect
The tmpfs mount at /tmp allows writable temp storage, the volume mount maps host logs to /var/log, and --name sets the container's name.