Skip to content

Latest commit

 

History

History
 
 

container

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Based on https://github.com/rootfs/install-glusterfs-on-fc21.

Background

A Docker host (such as CoreOS and RedHat Atomic Host) usually is a minimal OS without Gluster client package. If you want to mount a Gluster filesystem, it is quite hard to do it on the host.

Solution

I just worked out a solution to create a Super Privileged Container and run mount in the SPC's namespace but create the mount in host's namespace.

The idea is to inject my own mount before mount(2) is called, so we can reset the namespace, thank Colin for the mount patch idea.

But since I don't want to patch any existing util, I followed Sage Weil's suggestion and used ld.preload instead. This idea can thus be applied to gluster, nfs, cephfs, and so on, once we update the switch here

The code is at my repo. Docker image is jsafrane/glusterfs-mounter

How it works

First pull my Docker image

# docker pull jsafrane/glusterfs-mounter

Then run the image in Super Privileged Container mode

#  docker run  --privileged -d  --net=host -v /dev:/dev -v /mnt:/mnt -v /proc:/host/proc -v /run:/run -e HOSTPROCPATH=/host jsafrane/glusterfs-mounter

Use the container to run the mount, note the /mnt/test is in host's name space

# docker exec mount -t glusterfs <your_gluster_brick>:<your_gluster_volueme>  /mnt/test

Finally, you can check on your Docker host to see this gluster fs mount at /mnt/test.