I am planning to move docker data (images and containers) to separate drive as they require many space.
As I know I can move /var/lib/docker
to separate drive and create soft link to it. But I have read that BTRFS is a best file system option for docker.
But I suspect it is not enough to format external drive to BTRFS and move existing folder to it. As I see the content of this folder depends on the using file system.
How can I move (recreate) docker folder (images and containers) on the external drive with different file system correctly?
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 rundocker 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 -
docker save IMAGEID > /tmp/redis.tar
The above step can also be accomplished by modifying /etc/default/docker.
You should be able to see the images and run containers from here. For containers, you can also try
export
andimport
methods, i have never tried that one though.