Hi all,
A couple of weeks ago, at the end of the docker hackday, I demo-ed dockerlite[1], a re-implementation of docker with posix shell scripts, and using BTRFS instead of AUFS for images and containers storage. Dockerlite proved itself to be an incredibly useful sandbox to test new concepts.
The first result is the implementation of basic docker operations using BTRFS instead of AUFS. Instead of using AUFS layers, it uses BTRFS subvolumes and snapshots. It is very efficient (since it doesn’t have to perform copy-up like AUFS) and down the road should be a more viable option than AUFS.
The code is available[2] with a couple of caveats:
– BTRFS has no notion of “rw layer”, and has no easy way to list the differences between snapshots (i.e. between a container and its image)[3]; therefore, “docker diff” will not work as expected (it will list all the files of the container instead of listing only modifications) and the result of “docker commit” will be a full image (instead of a differential image). This will be improved in future versions. Meanwhile, you should be able do “docker pull” existing images without any problem.
– BTRFS IS VERY SENSITIVE TO LOW DISK SPACE CONDITIONS. So if you test that code, make sure that you have plenty of disk space. If disk space drops below 1 GB, stop, and enlarge your volume. Otherwise, the Go runtime might crash or freeze (even if there seems to be disk space available). I wasted almost 1 day to debug this issue (I was trying to understand why some tests would randomly fail…), I hope nobody else will hit it 🙂
The code is based on the 0.3.2 branch of docker. Feel free to give it a try (e.g. if you want to try docker on machines without AUFS support). If you want to see “docker diff” work correctly, and/or if you want to be able to “docker push” without uploading a full image, tell me, so I can know if there is interest for the feature 🙂
[1] https://github.com/jpetazzo/dockerlite
[2] https://github.com/jpetazzo/docker/compare/dotcloud:v0.3.2…btrfs
[3] “btrfs subvol find-new” only shows new and changed files; deleted files and metadata updates are not listed
One Response to “BTRFS support for docker”
rektide
There was a ticket #443 for BTRFS support. It got closed for reasons I don’t understand- keeb asserted it’s a use case for plugins and closed it. But I’m not sure why it wouldn’t still merit a ticket. I’m not sure if anything has happened since May 2013 when your btrfs tree was last updated, and when the 443 ticket was last genuinely active- is there any status update at all on BTRFS in docker?