HiveBrain v1.2.0
Get Started
← Back to all entries
patterndockerMinor

Do docker layers work at file level or block level?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
filedockerlevelblockworklayers

Problem

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?

Solution

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.

Context

StackExchange DevOps Q#17244, answer score: 2

Revisions (0)

No revisions yet.