DELAPARRA
Index
Color
NL
Category: Docker

bind mount

Explained by Updated

What is bind mount?

bind mount: Mounts a specific host directory or file into the container. Changes flow both ways — great for live-reloading source in development. A bind mount makes a folder or file from your computer appear inside a container. With -v $(pwd)/src:/app/src, the container sees your source code directly, and edits on either side are visible on the other.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about bind mount

How is bind mount used in practice?

In development this is what makes live reloading work. You edit in your editor, and the app in the container picks up the change without rebuilding the image.

What should you keep in mind with bind mount?

In production, bind mounts are usually the wrong tool. They tie the container to a specific folder on a specific server, and the image no longer contains everything it needs. Use named volumes for data and bake the code into the image. Watch out for file permissions too, because the user inside the container may not match the owner of the files on your machine.

What does an example of bind mount look like?

docker run -v $(pwd)/src:/app/src myapp:1.0

At a glance

CategoryDocker
Explained by
Updated

More Docker terms

All terms starting with B

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.