or: how I learned to love running stateful docker containers and stop worrying where the data is
(Portable "volumes", hee hee.)
When you want to run Docker in production, you want to run it across multiple machines and you probably want to use some orchestration tools. However, when you attach a volume to a Docker container, the machine it's running on becomes a pet when it should be cattle.
You should be able to run a stateful container with a given volume on any host in your cluster, and the platform should handle moving data around as necessary.
powerstrip-flocker
allows you to use the regular docker
CLI commands to create or move flocker volumes, automatically moving volumes around between hosts in the cluster as-needed.
powerstrip-flocker
connects the Docker Remote API to the new Flocker Volumes API via Powerstrip.
Write some data into a volume on one host, read it from another:
$ ssh node1 docker run -v /flocker/demo:/data busybox sh -c "echo fish > /data/file"
$ ssh node2 docker run -v /flocker/demo:/data busybox sh -c "cat /data/file"
fish
Note that the volume above has become "global" to both hosts.
Finally you can run stateful containers in docker and stop worrying about where the data is.
In other words, powerstrip-flocker
exposes a global namespace (/flocker/*
) of volumes which flocker will move into place just-in-time before letting docker start your containers.
Because powerstrip-flocker presents a standard docker api - it means that the full gamut of orchestration tools can work with it:
These tools don't have the concept of "portable volumes" - by leveraging the Powerstrip API - powerstrip-flocker brings this concept to all of them for free.
Equally, powerstrip-flocker will work alongside other docker extension projects like networking tools:
The above tools "wrap" the docker cli and it was impossible to use them alongside other extensions like Flocker. This is because both tools "wrap" the docker cli meaning only one can be used per container.
Powerstrip allows the composition of multiple adapters. This means that a single docker host can now implement solutions for two of the critical issues which crop up when you run Docker on multiple hosts in production: storage and networking.
This is a very early technology preview and has some big gaps. What's more, powerstrip itself is a prototype for the new Docker remote API extensions mechanism, and is therefore by definition unstable.
But, you can kick the tyres and try it today!
Then let us know what you think, to encourage us or tell us we're stupid.
We've put together a special demo preview environment:
You can try out our demo environment either with vagrant on local files, or on AWS.
This uses vagrant to bring up the demo on your local machine.
Click here for the Vagrant demo
This uses vagrant to bring up the demo on AWS EC2 instances.