Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
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.
✗ Incorrect
The command uses $(pwd) to bind mount the current directory on the host to /app inside the container.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping host and container paths.
Using relative paths instead of absolute paths.
✗ Incorrect
The host directory /home/user/project is mounted to /usr/src/app inside the container.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Missing colon between host and container paths.
Reversing the order of paths.
✗ Incorrect
The correct syntax for bind mounting is host_path:container_path, so $(pwd):/app is correct.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping host and container paths.
Forgetting the :ro suffix for read-only.
✗ Incorrect
The host directory /data is mounted to /app inside the container with read-only mode specified by :ro.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using :ro instead of :rw for read-write access.
Using 'root' instead of a numeric user ID.
✗ Incorrect
The host directory /src is bind mounted to /app with read-write access, and the container runs as user ID 1000.