0
0
Dockerdevops~10 mins

Read-only filesystem containers in Docker - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
A--name readonly
Balpine
C-v /data:/data
D-p 80:80
Attempts:
3 left
💡 Hint
Common Mistakes
Putting volume mount options in place of the image name.
Forgetting to specify the image name.
2fill in blank
medium

Complete 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'
A/tmp
B/home
C/etc
D/var/log
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.
3fill in blank
hard

Fix 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'
A/var/log:/tmp
B/var/log
C/tmp:/var/log
D/var/log:/var/log
Attempts:
3 left
💡 Hint
Common Mistakes
Using only the container path without specifying the host path.
Reversing the host and container paths.
4fill in blank
hard

Fill 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'
A/tmp
B/var/cache
C/var/log
D/home
Attempts:
3 left
💡 Hint
Common Mistakes
Mounting tmpfs on directories that should remain read-only.
Using the same directory for both mounts.
5fill in blank
hard

Fill 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'
A/tmp
B/host/logs:/var/log
Creadonly_container
D/var/cache
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing volume mount syntax.
Forgetting to specify the container name.
Using incorrect paths for tmpfs or volume mounts.