Volume mount vs Bind mount

Hi,

For course ’ Docker - SWARM | SERVICES | STACKS - Hands-on’ , module 3 and Lab ’ Docker - SWARM | SERVICES | STACKS - Hands-on’… here we did not implement bind mounts instead we just did volume mounting…

I was expecting this Lab was to let us understand usage of volume as well as bind mounts, but that was not the case.

Please clarify…

In docker terminology, a “bind mount” mounts a directory on the host, but a docker volume exists internal to docker itself, so a “volume mount” uses that internal form of storage. I’m not sure which labs you are referring to – the names you are using are ambiguous – so a link to the labs would help me figure out what you are seeing vs. what you are expecting to see.

Hi @rob_kodekloud ,

thanks for your reply, here is a link ‘Docker - SWARM | SERVICES | STACKS - Hands-on Course | KodeKloud’ for the labs which I was referring in my earlier comment…

What I am seeing is usage of volume mount only and what I was expecting is to see the usage of bind mount as well because, as per lab usage… we should be using bind mount for data storage such that in case if container goes down then we will still have data, but in lab exercise it did not make use of bind mount… instead it always use volume mount…

Let me know if it help you get my question clear.

Actually, that isn’t the case: docker volumes are persistent. This is different from the file system of a container.

Also, bind mounts can have issues with permissions due to what process owns the files in the bound directory, which is not as much an issue with docker volumes.