I wanted a simpler way to assign gluster volumes in new stacks without having to create directories by hand There are variety of community plugins for this.
I chose to use this one https://github.com/chrisbecke/glusterfs-volume
It creates a directory called <stackname>_<volumename>
for each volume defined in the stack.
Assume you setup glusterfs per this gist here
In my enviroment this is the command I used to install the plugin.
sudo docker plugin install --alias gluster-vol1 chrisbecke/glusterfs-volume GFS_VOLUME=gluster-vol1 GFS_SERVERS=docker01.mydomain.com,docker02.mydomain.com,docker03.mydomain.com
followed by
sudo docker plugin enable gluster-vol1
Now when a volume needed it can be specified as follows and created on the fly.
This example is from adguard.
- there are two directories needed, one for work and one for conf.
- these are defined at runtime by the \volumes lines after the services section
- in the service section these volume are called and mapped in the normal way
version: '3.2'
services:
adguard1:
image: 'adguard/adguardhome:latest'
restart: always
volumes:
- work:/opt/adguardhome/work
- config:/opt/adguardhome/conf
networks:
- adguard1
volumes:
work:
driver: gluster-vol1
config:
driver: gluster-vol1
networks:
adguard1:
external: true
The plugin driver can't be used for a file only a directory, if you need a file you can either use docker configs or you can create the file manually in you glusterfs directory and map in as normal
In the example above it would create in my configuration \mount\glustervol\adguard_config
and \mount\glustervol\adguard_work
and these would be mapped into the container
Hi, i've an error in this step when i try to install the docker plugins :
Anyone have any idea ?