3

I'm considering using a Docker image as way to snapshot a MySQL database after fixtures have been loaded, in order to quickly restore the snapshot before each acceptance test.

In order for this to be fast enough, the layer filesystem should operate at block level, not file level: if every (potentially large enough) database file has to be copied before being written to, this would be quite a bottleneck.

Do Docker layers operate at file level, or block level? Does this depend on the storage driver?

BenMorel
  • 198
  • 1
  • 8
  • As I read it the layers are to be interpreted as separate images. I would conclude that means file level, but I am unsure. – JoSSte Jan 16 '23 at 22:36

1 Answers1

2

The answer depends on the storage driver you are using with Docker. The documentation on selecting a storage driver indicates that the overlay2, aufs and overlay drivers all work at the file level rather than the block level. These are the most commonly used and best supported storage drivers.

devicemapper, btrfs and zfs are mentioned as block-level storage drivers with better performance for write-heavy workloads.