I cant seem to wrap my head around volumes vs binding a path on the host to a container in Docker

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

Ch33rios

Member
Nov 29, 2016
102
6
18
43
I've only been seriously looking into docker for the last few weeks or so but I'm really enjoying learning about all its capabilities. However, one thing I'm still having trouble understanding is the actual use-cases for using a mapped location on the host vs just using a volume.

  • Volumes are specific to docker and aren't really usable (as far as I know) by the host OS
  • Both volumes and mapped OS folders can be used/referenced by multiple containers
  • Both are persist and can be reused even after a container is destroyed (although re-using a volume after container destruction seems difficult from my new perspective since the names of volumes are not human readable but I think you can change that)
  • Mapped OS folders have no size restriction where-as volumes I believe have a maximum limit of 100GB in the newest version of Docker (previously it was 10GB if I have googled properly)

So what is the actual determinant when building a new container/stack in docker to leverage a volume vs a mapped drive path?

Additionally, would jumping headlong into Rancher server be good when starting off or just using Portainer? Rancher seems to provide a notably large list of added capabilities but it is much more complex that Portainer. I feel like Portainer is just a GUI version of the basic docker cli commands where-as Rancher adds on a whole new suite of capabilities in addition to allowing users to 'do the basics'. Obviously Im not doing a huge swarm of docker nodes at my house so maybe Rancher is a bit too big to digest but just was wondering what other folks use the most (note I dont mind taking a hard road to learn Rancher if its truly a solid product).

Thanks in advance!
 

PigLover

Moderator
Jan 26, 2011
3,184
1,545
113
Persistent volumes were part of Docker from early days. Mapped volumes were added later. For the most part you can think of persistent volumes to be the 'old' way and mapped volumes to be the current preferred method.

Sent from my SM-G950U using Tapatalk
 

Ch33rios

Member
Nov 29, 2016
102
6
18
43
Persistent volumes were part of Docker from early days. Mapped volumes were added later. For the most part you can think of persistent volumes to be the 'old' way and mapped volumes to be the current preferred method.

Sent from my SM-G950U using Tapatalk
Excellent thanks! Glad that was a simple answer :D