Docker
/Intermediate
Bind Mounts
Definition
A storage option where a specific, user-defined file or directory on the Host machine is directly mounted into a container. The container accesses the exact same physical files the Host sees.
Explain Like I'm New
A two-way window. You glue a folder on your MacBook directly to a folder inside the container. If you edit a file on your MacBook, the container instantly sees the change. If the container deletes a file, it is deleted from your MacBook.
Real World Example
Live-reloading in local development. You run a React app container and bind mount your laptop's `src` folder using `-v $(pwd)/src:/app/src`. When you hit 'Save' in VS Code on your laptop, the React server inside the container instantly recompiles.
Common Use Cases
- •Local code development
- •Sharing configuration files
Interview Questions
basic
- Which storage type requires you to specify an exact, absolute file path on your host machine: Volumes or Bind Mounts?
intermediate
- Why are Bind Mounts considered a security risk in production environments?