Skip to content

Commit 588a76f

Browse files
committed
engine: containerd default storage backend
Signed-off-by: David Karlsson <[email protected]>
1 parent 59945a6 commit 588a76f

File tree

7 files changed

+228
-71
lines changed

7 files changed

+228
-71
lines changed

content/manuals/engine/daemon/_index.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,24 +98,34 @@ The Docker daemon persists all data in a single directory. This tracks
9898
everything related to Docker, including containers, images, volumes, service
9999
definition, and secrets.
100100

101-
By default this directory is:
101+
By default the daemon stores data in:
102102

103-
- `/var/lib/docker` on Linux.
104-
- `C:\ProgramData\docker` on Windows.
103+
- `/var/lib/docker` on Linux
104+
- `C:\ProgramData\docker` on Windows
105105

106-
You can configure the Docker daemon to use a different directory, using the
107-
`data-root` configuration option. For example:
106+
When using the [containerd image store](/manuals/engine/storage/containerd.md)
107+
(the default for Docker Engine 29.0 and later on fresh installations), image
108+
and container snapshots are stored in `/var/lib/containerd`. Other daemon data
109+
(volumes, configs, secrets) remains in `/var/lib/docker`.
110+
111+
When using [classic storage drivers](/manuals/engine/storage/drivers/_index.md)
112+
like `overlay2` (the default for upgraded installations), all data is stored in
113+
`/var/lib/docker`.
114+
115+
### Configure the data directory location
116+
117+
You can configure the Docker daemon to use a different directory using the
118+
`data-root` configuration option:
108119

109120
```json
110121
{
111122
"data-root": "/mnt/docker-data"
112123
}
113124
```
114125

115-
Since the state of a Docker daemon is kept on this directory, make sure you use
116-
a dedicated directory for each daemon. If two daemons share the same directory,
117-
for example, an NFS share, you are going to experience errors that are difficult
118-
to troubleshoot.
126+
Make sure you use a dedicated directory for each daemon. If two daemons share
127+
the same directory, for example an NFS share, you will experience errors that
128+
are difficult to troubleshoot.
119129

120130
## Next steps
121131

content/manuals/engine/storage/_index.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@ aliases:
88
- /storage/
99
---
1010

11+
Docker storage covers two different concepts:
12+
13+
**Container data persistence** (this page): How to store application data
14+
outside containers using volumes, bind mounts, and tmpfs mounts. This data
15+
persists independently of container lifecycle.
16+
17+
**Daemon storage backends** ([containerd image store](containerd.md) and
18+
[storage drivers](drivers/)): How the daemon stores image layers and container
19+
writable layers on disk.
20+
21+
This page focuses on container data persistence. For information about how
22+
Docker stores images and container layers, see
23+
[containerd image store](containerd.md) or [Storage drivers](drivers/).
24+
25+
## Container layer basics
26+
1127
By default all files created inside a container are stored on a writable
1228
container layer that sits on top of the read-only, immutable image layers.
1329

@@ -78,9 +94,15 @@ Docker Engine API using a named pipe.
7894

7995
## Next steps
8096

97+
For more details on persistent data storage for containers:
98+
8199
- Learn more about [volumes](./volumes.md).
82100
- Learn more about [bind mounts](./bind-mounts.md).
83101
- Learn more about [tmpfs mounts](./tmpfs.md).
84-
- Learn more about [storage drivers](/engine/storage/drivers/), which
85-
are not related to bind mounts or volumes, but allow you to store data in a
86-
container's writable layer.
102+
103+
If you want to explore how the Docker daemon stores data:
104+
105+
- Learn about the [containerd image store](containerd.md), the default storage
106+
backend for Docker Engine 29.0 and later.
107+
- Learn about [storage drivers](drivers/), the legacy approach to storing image
108+
layers and container writable layers.

content/manuals/engine/storage/containerd.md

Lines changed: 122 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,154 @@
22
title: containerd image store with Docker Engine
33
linkTitle: containerd image store
44
weight: 50
5-
keywords: containerd, snapshotters, image store, docker engine
6-
description: Learn how to enable the containerd image store on Docker Engine
5+
keywords: containerd, snapshotters, image store, docker engine, migration
6+
description: Learn about the containerd image store and how to migrate to it
77
aliases:
88
- /storage/containerd/
99
---
1010

11-
{{< summary-bar feature_name="containerd" >}}
11+
The containerd image store is the default storage backend for Docker Engine
12+
29.0 and later on fresh installations. If you upgraded from an earlier version,
13+
your daemon continues using the legacy graph drivers (overlay2) until you
14+
migrate.
1215

1316
containerd, the industry-standard container runtime, uses snapshotters instead
14-
of the classic storage drivers for storing image and container data.
15-
While the `overlay2` driver still remains the default driver for Docker Engine,
16-
you can opt in to using containerd snapshotters as an experimental feature.
17+
of classic storage drivers for storing image and container data.
1718

18-
To learn more about the containerd image store and its benefits, refer to
19-
[containerd image store on Docker Desktop](/manuals/desktop/features/containerd.md).
19+
> [!NOTE]
20+
> The containerd image store is not available when using user namespace
21+
> remapping (`userns-remap`). See
22+
> [moby#47377](https://github.com/moby/moby/issues/47377) for details.
23+
24+
## Why use the containerd image store
25+
26+
The containerd image store uses snapshotters to manage how image layers are
27+
stored and accessed on the filesystem. This differs from the classic graph
28+
drivers like overlay2.
29+
30+
The containerd image store enables:
31+
32+
- Building and storing multi-platform images locally. With classic storage
33+
drivers, you need external builders for multi-platform images.
34+
- Working with images that include attestations (provenance, SBOM). These use
35+
image indices that the classic store doesn't support.
36+
- Running Wasm containers. The containerd image store supports WebAssembly
37+
workloads.
38+
- Using advanced snapshotters. containerd supports pluggable snapshotters that
39+
provide features like lazy-pulling of images (stargz) or peer-to-peer image
40+
distribution (nydus, dragonfly).
41+
42+
For most users, the migration is transparent. The storage backend changes, but
43+
your workflows remain the same.
2044

2145
## Enable containerd image store on Docker Engine
2246

23-
Switching to containerd snapshotters causes you to temporarily lose images and
24-
containers created using the classic storage drivers.
25-
Those resources still exist on your filesystem, and you can retrieve them by
26-
turning off the containerd snapshotters feature.
47+
If you're upgrading from an earlier Docker Engine version, you need to manually
48+
enable the containerd image store.
49+
50+
> [!IMPORTANT]
51+
> Switching storage backends temporarily hides images and containers created
52+
> with the other backend. Your data remains on disk. To access the old images
53+
> again, switch back to your previous storage configuration.
54+
55+
Add the following configuration to your `/etc/docker/daemon.json` file:
56+
57+
```json
58+
{
59+
"features": {
60+
"containerd-snapshotter": true
61+
}
62+
}
63+
```
64+
65+
Save the file and restart the daemon:
66+
67+
```console
68+
$ sudo systemctl restart docker
69+
```
70+
71+
After restarting the daemon, verify you're using the containerd image store:
72+
73+
```console
74+
$ docker info -f '{{ .DriverStatus }}'
75+
[[driver-type io.containerd.snapshotter.v1]]
76+
```
77+
78+
Docker Engine uses the `overlayfs` containerd snapshotter by default.
79+
80+
## Migrate from overlay2 to containerd image store
2781

28-
The following steps explain how to enable the containerd snapshotters feature.
82+
Docker Engine provides an automatic migration feature to help you switch from
83+
the legacy overlay2 driver to the containerd image store.
2984

30-
1. Add the following configuration to your `/etc/docker/daemon.json`
31-
configuration file:
85+
### Basic migration
86+
87+
To migrate automatically when you remove all images and containers:
88+
89+
1. Add the migration feature to your `/etc/docker/daemon.json`:
3290

3391
```json
3492
{
3593
"features": {
36-
"containerd-snapshotter": true
94+
"containerd-migration": true
3795
}
3896
}
3997
```
4098

41-
2. Save the file.
42-
3. Restart the daemon for the changes to take effect.
99+
2. Remove all images and containers:
100+
101+
```console
102+
$ docker rm -f $(docker ps -aq)
103+
$ docker rmi -f $(docker images -q)
104+
```
105+
106+
3. Restart the daemon:
43107

44108
```console
45109
$ sudo systemctl restart docker
46110
```
47111

48-
After restarting the daemon, running `docker info` shows that you're using
49-
containerd snapshotter storage drivers.
112+
After restart, the daemon uses the containerd image store. Your old overlay2
113+
data remains on disk but is hidden. If you switch back to overlay2, that data
114+
becomes accessible again.
115+
116+
### Threshold-based migration
117+
118+
For daemons with existing images, you can set a size threshold for automatic
119+
migration. If your graph driver content doesn't exceed the threshold, the
120+
daemon migrates automatically on restart.
121+
122+
Set the `DOCKER_MIGRATE_SNAPSHOTTER_THRESHOLD` environment variable in your
123+
daemon's environment. For systemd, use `systemctl edit`:
50124

51125
```console
52-
$ docker info -f '{{ .DriverStatus }}'
53-
[[driver-type io.containerd.snapshotter.v1]]
126+
$ sudo systemctl edit docker.service
54127
```
55128

56-
Docker Engine uses the `overlayfs` containerd snapshotter by default.
129+
Add the following in the editor that opens:
130+
131+
```ini
132+
[Service]
133+
Environment="DOCKER_MIGRATE_SNAPSHOTTER_THRESHOLD=100GB"
134+
```
135+
136+
Save and close the editor, then restart the daemon:
137+
138+
```console
139+
$ sudo systemctl restart docker
140+
```
141+
142+
If the overlay2 content is under 100GB, the daemon switches to the containerd
143+
image store on restart. The overlay2 data remains on disk.
144+
145+
> [!NOTE]
146+
> Migrating with existing data leaves that data inaccessible until you switch
147+
> back to the overlay2 driver. The data isn't deleted, just hidden. If you have
148+
> local images you want to migrate to the containerd image store, export them
149+
> first with `docker save` or push them to a registry.
150+
151+
## Additional resources
152+
153+
To learn more about the containerd image store and its capabilities in Docker
154+
Desktop, see
155+
[containerd image store on Docker Desktop](/manuals/desktop/features/containerd.md).

content/manuals/engine/storage/drivers/_index.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: Learn the technologies that support storage drivers.
3-
keywords: container, storage, driver, btrfs, overlayfs, vfs, zfs
3+
keywords: container, storage, driver, btrfs, overlayfs, vfs, zfs, containerd
44
title: Storage drivers
55
weight: 40
66
aliases:
@@ -9,6 +9,16 @@ aliases:
99
- /engine/userguide/storagedriver/imagesandcontainers/
1010
---
1111

12+
> [!NOTE]
13+
> Docker Engine 29.0 and later uses the
14+
> [containerd image store](../containerd.md) by default for fresh installations.
15+
> The containerd image store uses snapshotters instead of the classic storage
16+
> drivers described on this page. If you're running a fresh installation of
17+
> Docker Engine 29.0 or later, or if you've migrated to the containerd image
18+
> store, this page provides background on how image layers work but the
19+
> implementation details differ. For information about the containerd image
20+
> store, see [containerd image store](../containerd.md).
21+
1222
To use storage drivers effectively, it's important to know how Docker builds and
1323
stores images, and how these images are used by containers. You can use this
1424
information to make informed choices about the best way to persist data from

content/manuals/engine/storage/drivers/overlayfs-driver.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ This page refers to the Linux kernel driver as `OverlayFS` and to the Docker
1212
storage driver as `overlay2`.
1313

1414
> [!NOTE]
15-
>
15+
> Docker Engine 29.0 and later uses the
16+
> [containerd image store](/manuals/engine/storage/containerd.md) by default.
17+
> The `overlay2` driver is a legacy storage driver. For more information, see
18+
> [Select a storage driver](/manuals/engine/storage/drivers/select-storage-driver.md).
19+
20+
> [!NOTE]
1621
> For `fuse-overlayfs` driver, check [Rootless mode documentation](/manuals/engine/security/rootless.md).
1722
1823
## Prerequisites
1924

20-
OverlayFS is the recommended storage driver, and supported if you meet the following
21-
prerequisites:
25+
The `overlay2` driver is supported if you meet the following prerequisites:
2226

2327
- Version 4.0 or higher of the Linux kernel, or RHEL or CentOS using
2428
version 3.10.0-514 of the kernel or higher.

0 commit comments

Comments
 (0)