/docker-volume-gvfs

Use GVfs as a backend for docker volume

Primary LanguageGoMIT LicenseMIT

docker-volume-gvfs License Project Status

GitHub release Go Report Card codecov master : Travis master develop : Travis develop

Use GVfs as a backend for docker volume

Status : proof of concept (working)

By using GVfs this plugins allow the use of various backend as storage.

Dedends on gvfs and gvfsd-fuse (so dbus indirectly)

Packages : Archlinux

Working: SSH/SFTP/DAV/DAVS/FTP
In Progress/Not tested: FTPS/NFS/SMB/CIFS/...

Build

make

Start daemon

./docker-volume-gvfs daemon
OR in a docker container
docker run -d --device=/dev/fuse:/dev/fuse --cap-add=SYS_ADMIN --cap-add=MKNOD  -v /run/docker/plugins:/run/docker/plugins -v /var/lib/docker-volumes/gvfs:/var/lib/docker-volumes/gvfs:shared sapk/docker-volume-gvfs

For more advance params : ./docker-volume-gvfs --help OR ./docker-volume-gvfs daemon --help

Run listening volume drive deamon to listen for mount request

Usage:
  docker-volume-gvfs daemon [flags]

Flags:
  -d, --dbus string        DBus address to use for gvfs.  Can also set default environment DBUS_SESSION_BUS_ADDRESS
  -o, --fuse-opts string   Fuse options to use for gvfs moint point (default "big_writes,allow_other,auto_cache")

Global Flags:
  -b, --basedir string   Mounted volume base directory (default "/var/lib/docker-volumes/gvfs")
  -v, --verbose          Turns on verbose logging

Create and Mount volume

docker volume create --driver gvfs --opt url=ftp://user@url --opt password=pass --name test
docker run -v test:/mnt --rm -ti ubuntu

NB : For mounting SSH/SFTP it is usefull to set a ssh_config file for the running user in order to use a ssh key as authentification.

Docker plugin (New)

docker plugin install sapk/plugin-gvfs
docker volume create --driver sapk/plugin-gvfs --opt url=ftp://user@url --opt password=pass --name test
docker run -v test:/mnt --rm -ti ubuntu

Docker-compose

volumes:
  some_vol:
    driver: sapk/plugin-gvfs
    driver_opts:
      url: "ftp://user@url"
      password: "pass"

Known bug:

If when trying to start a container you get this error :

docker: Error response from daemon: chown /var/lib/docker-volumes/gvfs/ftp:host=10.8.0.7,user=sapk: function not implemented.

Try to start the container with the :nocopy attribute on the volume like that :

docker run -v test:/mnt:nocopy --rm -ti ubuntu

Inspired from :