Docker – How does CoreOS migrate Docker containers, when Docker volumes are in use

coreosdockermigration

I'm just learning how to use CoreOS and already ran into the first problem that really keeps bothering me: When using fleetctl to start and manage units, I learned that a unit is moved automatically to another machine, when the machine chosen to run the unit reboots or becomes unreachable to the cluster for another reason. Imagine now a situation when you have a unit running a Docker container that has access to a certain directory (via a Docker volume) present only on a specific machine.

What happens if the unit running this container is moved to another machine? I suppose the unit will fail since the directory that is supposed to be mounted as a Docker volume is not present on the new machine. Does this actually happen? And how could I circumvent this problem? Generally, how can I persist working data used by a docker container under the circumstances of auto-migrating containers?

Best Answer

I guess for now it's your responsibility to make sure data is available. You might want to check https://github.com/ClusterHQ/flocker which is specifically designed to take care to take data along with docker containers. I think it relies on ZFS features which may rule out its usage on CoreOS. The only alternative I could come up with is using a highly available external volume mounted on CoreOS.