Docker Volumes vs Bind Mounts

Bind mount

File or directory on host mounted into container. You refer to this file/directory using the full file path used on the host.

The problem with a bind mount is you have to have the full host file path which may be different on different hosts. E.g. if you use /Users/dave it’s going to break if someone else doesn’t have a Users/dave directory.


While bind mounts are dependent on the directory structure of the host machine, volumes are completely managed by Docker. They’re created in  /var/lib/docker/volumesand you refer to them by name. E.g.

-v mysql_data:/containerdir

Here’s what this means:

  • the first field is the name of the volume. It’s unique on a given host machine
  • the second field is the path where the file or directory are mounted in the container–v-or—mount-flag

Leave a Reply

Your email address will not be published. Required fields are marked *