Move docker data (images and containers) to separate drive with different FS

As you stated simply moving or copying the docker images/containers from the default AUFS to BTRFS formatted drive is not going to work. So as a first step, you can commit all your containers as images and use docker save commands to save the images as .tar files and then once you have prepped docker to use btrfs, you run docker load to load the images into the new storage driver.

The steps would be roughly as follows - this is what i did in my Ubuntu 14.10 box -

  • Save your images
    docker save IMAGEID > /tmp/redis.tar
  • Prep btrfs
 mkfs.btrfs /dev/sdb
 mkdir /var/lib/docker-btrfs
 mount /dev/sdb /var/lib/docker-btrfs/
  • Stop docker and set docker to utilize btrfs and run it.
service docker stop
docker -d -s btrfs  --graph="/var/lib/docker-btrfs"  -H unix:///var/run/docker.sock

The above step can also be accomplished by modifying /etc/default/docker.

  • Load the images.
docker load --input /tmp/redis.tar

You should be able to see the images and run containers from here. For containers, you can also try export and import methods, i have never tried that one though.