Challenge - 5 Problems
Bind Mount Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Bind mount behavior with file changes
You run a Docker container with this command:
If you edit a file inside
docker run -it -v /host/app:/container/app ubuntu bash
If you edit a file inside
/host/app on your host machine, what happens inside the container's /container/app directory?Attempts:
2 left
💡 Hint
Think about what a bind mount does: it links host and container directories directly.
✗ Incorrect
A bind mount links the host directory to the container directory directly. Any changes on the host are immediately visible inside the container and vice versa.
❓ Configuration
intermediate2:00remaining
Correct bind mount syntax in docker-compose
Which docker-compose service configuration correctly sets a bind mount from the host
./src directory to the container /app directory?Attempts:
2 left
💡 Hint
Remember the format is host_path:container_path.
✗ Incorrect
In docker-compose, bind mounts use the format
host_path:container_path. So ./src:/app mounts the local src folder to /app inside the container.❓ Troubleshoot
advanced2:00remaining
Why are file changes not visible inside container?
You set up a bind mount with:
But when you edit files in
docker run -v /home/user/project:/app myimage
But when you edit files in
/home/user/project on the host, the container does not see the changes. What is the most likely cause?Attempts:
2 left
💡 Hint
Check the exact path on your host machine carefully.
✗ Incorrect
If the host path does not exist or is mistyped, Docker creates an empty directory inside the container, so changes on the host won't appear.
🔀 Workflow
advanced2:00remaining
Using bind mounts for live code development
You want to develop a Node.js app inside a Docker container and see code changes immediately without rebuilding the image. Which workflow is best?
Attempts:
2 left
💡 Hint
Think about how to avoid rebuilding the image for every code change.
✗ Incorrect
Bind mounts let the container use your local code directly, so changes appear immediately without rebuilding or copying files.
✅ Best Practice
expert2:00remaining
Security considerations with bind mounts
Which is the safest practice when using bind mounts in Docker for development?
Attempts:
2 left
💡 Hint
Think about limiting access to only what is necessary.
✗ Incorrect
Binding only the needed project directory limits the container's access to host files, reducing security risks.