How do I use Bind Volumes with Docker?
Can anyone recommend a way I can use bind volumes with Docker for my machine? I'd like to keep data to the host machine, not in container volumes?
It looks like you're trying to use bind mounts instead of volumes while working on your application.
Admittedly, I am not a Docker expert, but I was able to dig up some information on the difference between the two and some resources that may help you.
It looks like this has been an option for quite a while and you can find more about it in Docker's official documentation on Using Bind Mounts. From my experience, Docker's official guides are awesome and provide you with good examples and thorough guidance.
It looks like there are few limitations and behaviors to be aware of when it comes to bind mounts:
- They rely on docker host directory structure.
- They have different behavior for
- You can't control them from the Docker CLI.
- They are used mainly in development environments.
I was able to also find an additional article from Medium about Docker Volumes and Bind Mounts that is pretty interesting.
I hope that this helps get you started. If there are any Docker experts in the community, your input would be greatly appreciated here.