3

Google is turning up some bizarre results, including questions here at SO. I am aware that this isn't a supported/recommended configuration. However is this even an undocumented option?

If it is difficult, it's something I'll continue to pursue, but if it's just impossible and docker is engineered that way, I'll give up.

John O
  • 4,863
  • 8
  • 45
  • 78

1 Answers1

4

Volume plugins are your answer. Storage is a bit of an involved topic but I am currently running a mix of NFS / Gluster and SMB SAN hosted storage.

Have a read and test out different plugins:
https://docs.docker.com/engine/extend/plugins_volume/

Docker NFS, AWS EFS & Samba/CIFS Volume Plugin:
https://github.com/ContainX/docker-volume-netshare

Manually, you first create the Docker volume, specifying the driver:

$ docker volume create --driver=flocker volumename

Then you launch your container and mount the created volume:

$ docker container run -it --volume volumename:/data busybox sh

Here is an example of how the Gluster plugin was used in the Compose file:

volumes:
  CreatedVolumeName:
    driver: sapk/plugin-gluster
    driver_opts:
      voluri: ip_of_export:<export path>
services:
  service_name:
    image: image_name
    networks:
      - my_net
    volumes:
      - CreatedVolumeName:/etc (some internal mount in the container)
Spooky
  • 2,966
  • 8
  • 27
  • 41
Muscothym
  • 313
  • 2
  • 8
  • Thank you for this. This indeed seems to be the way to proceed and is officially supported. Going to have to put extra effort into it though, as I've barely got the thing compiled and don't seem to be able to make it work. Just sits there hanging, never completing or making a volume. – John O Mar 28 '18 at 20:11
  • 1
    I have experienced the same symptom when we started. Try running the mount commands on the host themselves first to confirm that your syntax and options are correct (and that the mounting path or hostname can resolve correcly.) once that is confirmed, then it should just be about making sure your compose file is syntactically correct. N.B. sorry if this is teaching how to suck eggs but I was amazed how many people ran into this. – Muscothym Apr 03 '18 at 09:37
  • After more digging around in github issues, it seems this simply isn't an option for Mac. Others have gotten it to compile, but it does nothing. – John O Apr 13 '18 at 20:29