Jérôme Petazzoni

BTRFS support for docker

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

About Jérôme Petazzoni

 

Jérôme is a senior engineer at dotCloud, where he rotates between Ops, Support and Evangelist duties and has earned the nickname of “master Yoda”. In a previous life he built and operated large scale Xen hosting back when EC2 was just the name of a plane, supervized the deployment of fiber interconnects through the French subway, built a specialized GIS to visualize fiber infrastructure, specialized in commando deployments of large-scale computer systems in bandwidth-constrained environments such as conference centers, and various other feats of technical wizardry. He cares for the servers powering dotCloud, helps our users feel at home on the platform, and documents the many ways to use dotCloud in articles, tutorials and sample applications. He’s also an avid dotCloud power user who has deployed just about anything on dotCloud – look for one of his many custom services on our Github repository.

Connect with Jérôme on Twitter! @jpetazzo

,

Jérôme Petazzoni

BTRFS support for docker


One Response to “BTRFS support for docker”

  1. 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?

    Reply

Leave a Reply

Get the Latest Docker News by Email

Docker Weekly is a newsletter with the latest content on Docker and the agenda for the upcoming weeks.