Skip to content
BENIBIX Learn

Container Volume vs Bind Mount

People think a bind mount is just another volume, and it is not. A bind mount shows a host folder you chose inside the box. A volume is storage the container tool makes and looks after. Both can use the same -v flag, which is why they get mixed up. Use a bind mount to edit code, and a volume to keep a database's files.

Infrastructure📦 Containers

Container Volume

Storage that outlives the container. Files kept there stay when the box is gone.

A container volume is storage that lives outside the container. The container sees it as a normal folder. When the container is deleted, the volume and its files stay. A new container can plug in the same volume and carry on. This is how a database in a container keeps its data.

Example
Jack runs a database in a container and keeps its data in a volume. He swaps in a newer version. Every record is still there.
Why it matters
Without a volume, the files a container saves vanish with it. That is fine for an app, and a disaster for a database.
Full entry
Infrastructure📦 Containers

Bind Mount

A host folder shared straight into a container. Edits on either side show on both.

A bind mount shares a folder from the host computer straight into a container. The container sees the folder at a path you choose. A change on either side shows up on the other at once. People use it to edit code on a laptop and run it in the container. Unlike a volume, the files live wherever the host keeps them.

Example
Emma shares her project folder with a Node box. She saves a file in her editor, and the app inside picks up the change.
Why it matters
It ties a container to files you can see and edit. That makes it the usual choice while writing code.
Full entry

In one line

Container Volume
Storage that outlives the container. Files kept there stay when the box is gone.
Bind Mount
A host folder shared straight into a container. Edits on either side show on both.