Gluster volume plugin of docker !!

Does gluster volume plugin available for docker?

Yes, its available here .

This article talks about how to use this plugin and make use of gluster volume when spawning docker containers.

For the gluster volume plugin to work, we need experimental build of docker which can be fetched from docker github. If you dont have the experimental binary of docker running in your system get it from docker github.

github.com/docker/docker/tree/master/experimental have instructions on how to run docker experimental binary.

Once your docker daemon is running from experimental build, pull gluster volume plugin from github source.


[root@dhcp35-20 go]# go get github.com/calavera/docker-volume-glusterfs

As mentioned in the README file in github, you need to execute ‘docker-volume-glusterfs’ as shown below. That said, here the IP, “10.70.1.100” is my gluster server which export a replica volume called ‘test-vol’. For more details on gluster volume types and configuration please refer gluster.readthedocs.org/en/latest/ .


[root@dhcp35-20 go]# docker-volume-glusterfs -servers 10.70.1.100


[root@dhcp35-20 check1]# ps aux |grep docker
root 7674 0.0 0.0 7612 1596 pts/13 Sl+ 12:47 0:00 ./docker-volume-glusterfs -servers 10.70.1.100
root 8169 0.0 0.3 558828 29924 pts/14 Sl 12:52 0:00 ./docker-latest daemon

Once its done, we can spawn containers as shown below, where ‘test-vol’ is the gluster volume name and “/b1” is the mount point in spawned container, ‘docker.io/fedora’ is the image name.

‘touch /b1/second” create a file called ‘second’ in “/b1” mount point.

[root@]# ./docker-latest run -it –volume-driver glusterfs –volume test-vol:/b1 docker.io/fedora touch /b1/second


INFO[4891] POST /v1.21/containers/create
INFO[4892] POST /v1.21/containers/b3b61146188db97e3b2c96e1ae38dc53478287d557e24a26b0dcbf09be68140a/attach?stderr=1&stdin=1&stdout=1&stream=1
INFO[4892] POST /v1.21/containers/b3b61146188db97e3b2c96e1ae38dc53478287d557e24a26b0dcbf09be68140a/start
INFO[4892] POST /v1.21/containers/b3b61146188db97e3b2c96e1ae38dc53478287d557e24a26b0dcbf09be68140a/resize?h=46&w=190
INFO[4892] GET /v1.21/containers/b3b61146188db97e3b2c96e1ae38dc53478287d557e24a26b0dcbf09be68140a/json

Lets verify whether the file creation worked successfully and the new file (second) is available in brick path of gluster server node.

From ‘test-vol’ volume details, we can see that “/home/test-brick1” is one leg of replica volume in my setup.


Volume Name: test-vol
Type: Replicate
Volume ID: 2cebb33f-e849-40c1-9344-939025f80b1f
Status: Started
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: 10.70.1.100:/home/test-brick1
Brick2: 10.70.1.101:/home/test-brick2
Options Reconfigured:
performance.readdir-ahead: on
You have new mail in /var/spool/mail/root
[root@dhcp1-100 test-brick1]#

[root@dhcp1-100 test-brick1]# pwd
/home/test-brick1
[root@dhcp1-100 test-brick1]# ls
second

Awesome !! Isnt it ?

Thanks github.com/calavera for the plugin & Thanks neependra for pointers.

Digiprove sealCopyright secured by Digiprove © 2017 Humble Chirammal

Leave a Reply

Your email address will not be published. Required fields are marked *