<p>The answer depends on the storage driver you are using with Docker. The documentation on <a href="https://docs.docker.com/storage/storagedriver/select-storage-driver/#other-considerations" rel="nofollow noreferrer">selecting a storage driver</a> indicates that the <em>overlay2</em>, <em>aufs</em> and <em>overlay</em> drivers all work at the file level rather than the block level. These are the most commonly used and best supported storage drivers.</p>
<p><em>devicemapper</em>, <em>btrfs</em> and <em>zfs</em> are mentioned as block-level storage drivers with better performance for write-heavy workloads.</p>

CC BY-SA 4.0
2023-01-17T09:43:23.360Z
2023-01-17T09:43:23.360Z
Roderick Bant
<p>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.</p>
<p>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.</p>
<p><strong>Do Docker layers operate at file level, or block level?</strong> Does this depend on the storage driver?</p>

CC BY-SA 4.0
2023-01-16T22:36:33.930Z
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
<docker><containers>
Do docker layers work at file level or block level?
BenMorel
# Do docker layers work at file level or block level?

(Asked by: username_0 on 2023-01-16)

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?

**Tags:** docker, containers

> **Comments:**
> **username_1**: As I read it the layers are to be interpreted as separate images. I would conclude that means file level, but I am unsure.  

---

## 1 answers

### Answer by username_2 on 2023-01-17. Score: 2

The answer depends on the storage driver you are using with Docker. The documentation on [selecting a storage driver](https://docs.docker.com/storage/storagedriver/select-storage-driver/#other-considerations) 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.


---

