0
0
Dockerdevops~10 mins

Bind mounts for development 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 bind mount from the current directory to /app inside the container.

Docker
docker run -v [1]:/app myimage
Drag options to blanks, or click blank then click option'
A/app/data
B/container/data
C/host/data
D$(pwd)
Attempts:
3 left
💡 Hint
Common Mistakes
Using a container path instead of a host path for the bind mount.
Forgetting to specify the host directory before the colon.
2fill in blank
medium

Complete the Docker run command to mount the host directory /home/user/project to /usr/src/app inside the container.

Docker
docker run -v [1]:/usr/src/app myimage
Drag options to blanks, or click blank then click option'
A/var/lib/docker
B/usr/src/app
C/home/user/project
D/tmp
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping host and container paths.
Using relative paths instead of absolute paths.
3fill in blank
hard

Fix the error in the Docker run command to correctly bind mount the current directory to /app.

Docker
docker run -v [1] myimage
Drag options to blanks, or click blank then click option'
A$(pwd):/app
B$(pwd)/app
C/app:$(pwd)
D/app
Attempts:
3 left
💡 Hint
Common Mistakes
Missing colon between host and container paths.
Reversing the order of paths.
4fill in blank
hard

Fill both blanks to create a bind mount that maps the host directory /data to /app inside the container with read-only access.

Docker
docker run -v [1]:[2]:ro myimage
Drag options to blanks, or click blank then click option'
A/data
B/app
C/var/data
D/usr/app
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping host and container paths.
Forgetting the :ro suffix for read-only.
5fill in blank
hard

Fill all three blanks to create a bind mount that maps the host directory /src to /app inside the container with read-write access and sets the container user to 1000.

Docker
docker run -v [1]:[2]:rw --user [3] myimage
Drag options to blanks, or click blank then click option'
A/src
B/app
C1000
Droot
Attempts:
3 left
💡 Hint
Common Mistakes
Using :ro instead of :rw for read-write access.
Using 'root' instead of a numeric user ID.