Docker data volume sharer
Switch branches/tags
Nothing to show
Clone or download
gdiepen Updated volume-sharer.sh to make shares writable
In the original code, each of the shared data volumes was made read-only
Latest commit 443c5b1 Sep 26, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Dockerfile Added additional environment variables Aug 20, 2017
LICENSE Create LICENSE Aug 20, 2017
README.md Update README.md Aug 20, 2017
volume-sharer.sh Updated volume-sharer.sh to make shares writable Sep 26, 2017

README.md

volume-sharer

On my windows 10 laptop from work it is possible to make use of Docker, but due to security restrctions that are in place, I am not able to bind mount a windows folder in a container.

In order to be able to still work easily with data volumes and access the content of them from within my windows environment I updated the dperson/samba container image to not only contain a Docker installation to check all data volumes, but also keep on refreshing the list of shares whenever a data volumes are added/removed.

Usage

Most important is that we need to volume mount the docker volumes directory, as well as the docker socket.

This means that we will need the following:

  • -v /var/lib/docker/volumes:/docker_volumes to bind mount the directory holding all docker volumes
  • -v /var/run/docker.sock:/var/run/docker.sock to bind mount the docker socket, allowing the docker within the container to query information about the volumes

Windows

When running under windows, it will typically already run the SMB shares on the ports 139 and 445 so you cannot use these ports. In order to work around this, you can state that you do not want to bind the ports to the windows host system, but that I want to bind them to the docker image running in Hyper-V.

This is achieved by giving it the same net as the Hyper-V by using the following commandline: docker run --name volume-sharer --rm -v /var/lib/docker/volumes:/docker_volumes -p 139:139 -p 445:445 -v /var/run/docker.sock:/var/run/docker.sock --net=host -d gdiepen/volume-sharer

Linux

If you don't have samba running on your host-system, you can bind the ports. The complete commandline will be:

docker run --name volume-sharer --rm -v /var/lib/docker/volumes:/docker_volumes -p 139:139 -p 445:445 -v /var/run/docker.sock:/var/run/docker.sock -d gdiepen/volume-sharer

##More details I have placed more information on my blog article: https://www.guidodiepen.nl/2017/08/sharing-all-your-docker-data-volumes-via-samba/