Skip to content

Commit 56650cf

Browse files
authored
Merge pull request #23717 from dvdksn/containerd-default
engine: containerd default storage backend
2 parents 90f5fcf + 2595d2f commit 56650cf

File tree

8 files changed

+224
-80
lines changed

8 files changed

+224
-80
lines changed

_vale/config/vocabularies/Docker/accept.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ pgAdmin
161161
PKG
162162
plaintext
163163
plist
164+
pluggable
164165
Postgres
165166
PowerShell
166167
Python
@@ -183,6 +184,7 @@ Solr
183184
SonarQube
184185
Splunk
185186
SQLite
187+
stargz
186188
stdin
187189
stdout
188190
subfolder

content/manuals/engine/daemon/_index.md

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,24 +98,44 @@ 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+
contents and container snapshots are stored in `/var/lib/containerd`. Other
109+
daemon data (volumes, configs) 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 storage directory using
118+
the `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+
The `data-root` option does not affect image and container data stored in
127+
`/var/lib/containerd` when using the containerd image store. To change the
128+
storage location of containerd snapshotters, use the system containerd
129+
configuration file:
130+
131+
```toml {title="/etc/containerd/config.toml"}
132+
version = 2
133+
root = "/mnt/containerd-data"
134+
```
135+
136+
Make sure you use a dedicated directory for each daemon. If two daemons share
137+
the same directory, for example an NFS share, you will experience errors that
138+
are difficult to troubleshoot.
119139

120140
## Next steps
121141

content/manuals/engine/storage/_index.md

Lines changed: 26 additions & 6 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,13 @@ Docker Engine API using a named pipe.
7894

7995
## Next steps
8096

81-
- Learn more about [volumes](./volumes.md).
82-
- Learn more about [bind mounts](./bind-mounts.md).
83-
- 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.
97+
Learn more about container data persistence:
98+
99+
- [Volumes](./volumes.md)
100+
- [Bind mounts](./bind-mounts.md)
101+
- [tmpfs mounts](./tmpfs.md)
102+
103+
Learn more about daemon storage backends:
104+
105+
- [containerd image store](containerd.md)
106+
- [Storage drivers](drivers/)

content/manuals/engine/storage/containerd.md

Lines changed: 105 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,131 @@ title: containerd image store with Docker Engine
33
linkTitle: containerd image store
44
weight: 50
55
keywords: containerd, snapshotters, image store, docker engine
6-
description: Learn how to enable the containerd image store on Docker Engine
6+
description: Learn about the containerd image store
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+
enable the containerd image store.
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, switching to the containerd image store is transparent. The
43+
storage backend changes, but 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.
2749

28-
The following steps explain how to enable the containerd snapshotters feature.
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.
2954
30-
1. Add the following configuration to your `/etc/docker/daemon.json`
31-
configuration file:
55+
Add the following configuration to your `/etc/docker/daemon.json` file:
3256

33-
```json
34-
{
35-
"features": {
36-
"containerd-snapshotter": true
37-
}
38-
}
39-
```
57+
```json
58+
{
59+
"features": {
60+
"containerd-snapshotter": true
61+
}
62+
}
63+
```
4064

41-
2. Save the file.
42-
3. Restart the daemon for the changes to take effect.
65+
Save the file and restart the daemon:
4366

44-
```console
45-
$ sudo systemctl restart docker
46-
```
67+
```console
68+
$ sudo systemctl restart docker
69+
```
4770

48-
After restarting the daemon, running `docker info` shows that you're using
49-
containerd snapshotter storage drivers.
71+
After restarting the daemon, verify you're using the containerd image store:
5072

5173
```console
5274
$ docker info -f '{{ .DriverStatus }}'
5375
[[driver-type io.containerd.snapshotter.v1]]
5476
```
5577

5678
Docker Engine uses the `overlayfs` containerd snapshotter by default.
79+
80+
> [!NOTE]
81+
> When you enable the containerd image store, existing images and containers
82+
> from the overlay2 driver remain on disk but become hidden. They reappear if
83+
> you switch back to overlay2. To use your existing images with the containerd
84+
> image store, push them to a registry first, or use `docker save` to export
85+
> them.
86+
87+
## Experimental automatic migration
88+
89+
Docker Engine includes an experimental feature that can automatically switch to
90+
the containerd image store under certain conditions. **This feature is
91+
experimental**. It's provided for those who want to test it, but [starting
92+
fresh](#enable-containerd-image-store-on-docker-engine) is the recommended
93+
approach.
94+
95+
> [!CAUTION]
96+
> The automatic migration feature is experimental and may not work reliably in
97+
> all scenarios. Create backups before attempting to use it.
98+
99+
To enable automatic migration, add the `containerd-migration` feature to your
100+
`/etc/docker/daemon.json`:
101+
102+
```json
103+
{
104+
"features": {
105+
"containerd-migration": true
106+
}
107+
}
108+
```
109+
110+
You can also set the `DOCKER_MIGRATE_SNAPSHOTTER_THRESHOLD` environment
111+
variable to make the daemon switch automatically if you have no containers and
112+
your image count is at or below the threshold. For systemd:
113+
114+
```console
115+
$ sudo systemctl edit docker.service
116+
```
117+
118+
Add:
119+
120+
```ini
121+
[Service]
122+
Environment="DOCKER_MIGRATE_SNAPSHOTTER_THRESHOLD=5"
123+
```
124+
125+
If you have no running or stopped containers and 5 or fewer images, the daemon
126+
switches to the containerd image store on restart. Your overlay2 data remains
127+
on disk but becomes hidden.
128+
129+
## Additional resources
130+
131+
To learn more about the containerd image store and its capabilities in Docker
132+
Desktop, see
133+
[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: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@ 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 that is superseded by the
18+
> `overlayfs` containerd snapshotter. For more information, see
19+
> [Select a storage driver](/manuals/engine/storage/drivers/select-storage-driver.md).
20+
21+
> [!NOTE]
1622
> For `fuse-overlayfs` driver, check [Rootless mode documentation](/manuals/engine/security/rootless.md).
1723
1824
## Prerequisites
1925

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

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

0 commit comments

Comments
 (0)