The diode bridge is the simplest rectifier I know.
Rectifier lets you share a directory with a docker container (just like $yourvm
shared folders).
You don't have to install anything in your containers, and you only need to install diod
in the host. diod
is packaged on Ubuntu/Debian distros, and will automatically be apt-get install
-ed if needed.
Since it uses diod
to make a bridge, I called it rectifier. Yeah, that sucks, so if you have a better name, I'll steal it!
Download rectifier.sh:
curl https://gist.github.com/jpetazzo/5668338/raw/rectifier.sh > rectifier.sh
Then:
bash rectifier.sh 042baf /mnt /home/joe
This will mount /home/joe
(i.e. your home directory, if you happen to be joe
) on /mnt
inside the container 042baf
.
When you don't want to share the directory anymore, Ctrl+C to terminate diod
, then clean up the mount in the container by running:
bash rectifier.sh 042baf /mnt -
If the output format of docker inspect
changes, the program will be confused.
All containers (and possibly other machines on your local network, depending on your firewalling rules) can access your shared folders.
If you Ctrl+C (to terminate the sharing), the shared folder will still be mounted in the container (but it will be unavailable), and you won't be able to umount
it easily from the container (you have to use rectifier to umount).
It probably requires kernel 3.8 (for lxc-attach
to work properly).
It uses v9fs, because:
- it doesn't require any kind of package in the container (unlike FUSE et al.),
- the server configuration is dead simple, doesn't require a portmapper, and won't fuck up with existing file sharing protocols.
It runs diod
in TCP server mode, binding it to the docker gateway address, on a random TCP port, without authentication.
Then, it uses lxc-attach -e
to execute a mount
command in the context of the container without dropping privileges.