Use disk-backed containerd snapshotter in dind

This commit is contained in:
agentbox committed 2026-11-05 14:59:00 +00:00
1 parent 4b55d6e402
commit 6f19f86522
5 files changed
+39 -123

No files matched your search

+21 -66
View File
@@ -182,16 +182,24 @@ The dind image comes from the gVisor Docker-in-gVisor example under
The default Compose configuration starts dind with:
```yaml
command: --no-overlay
command: --disk-store
```
This skips the RAM-backed tmpfs at `/var/lib/docker` and uses the disk-backed
`./dind-data` volume instead, so image/build storage is not capped at a fixed
tmpfs size. The startup script also disables Docker 29's containerd snapshotter
for this mode.
`./dind-data` volume. It keeps Docker 29's containerd snapshotter enabled, which
supports image layers containing `security.capability` xattrs.
If you prefer a bounded RAM-backed store, remove `command: --no-overlay` and set
`DOCKER_TMPFS_SIZE` explicitly:
The dind image is built from `gvisor/images/basic/docker`. Its startup script
supports three modes:
```text
(no flag) RAM-backed tmpfs at /var/lib/docker
--disk-store disk-backed volume, containerd snapshotter enabled
--no-overlay disk-backed volume, containerd snapshotter disabled
```
If you prefer a bounded RAM-backed store, remove `command: --disk-store` and
set `DOCKER_TMPFS_SIZE` explicitly:
```yaml
environment:
@@ -207,66 +215,14 @@ failed to register layer: lsetxattr /usr/bin/ping:
xattr "security.capability": operation not supported
```
This is not a registry or authentication problem. gVisor's host-backed
filesystem path cannot set the `security.capability` xattr on files such as
`/usr/bin/ping`, which many Ubuntu runner images contain.
This happens when dind uses `--no-overlay` (Docker 29 classic overlay2/vfs)
on a host-backed volume. gVisor's host-backed filesystem path cannot set the
`security.capability` xattr in that mode.
The disk-backed dind setup needs an overlay filestore to support those xattrs.
A host daemon configuration example with the required runtime change is included
at:
```text
host/daemon.json.example
```
The relevant entry is:
```json
"runsc-docker": {
"path": "/usr/bin/runsc",
"runtimeArgs": [
"--net-raw",
"--allow-packet-socket-write",
"--overlay2=all:dir=/var/lib/gvisor-overlay"
]
}
```
Merge that runtime entry into the host's `/etc/docker/daemon.json`, then restart
the Docker daemon.
The Compose file mounts:
```text
./dind-overlay -> /var/lib/gvisor-overlay
```
With that runtime argument, Docker inside the sandbox may report the `vfs`
storage driver rather than overlay2, but image pulls with file capabilities work
and storage remains disk-backed.
Without this host runtime change, the working alternative is the RAM-backed
tmpfs mode above. The error is a gVisor filesystem/xattr limitation, not a
runner-image label or Compose volume problem.
## Performance (local test)
Short microbenchmarks with the disk-backed dind setup (`--no-overlay`, Docker
29.9.3, overlay2). The gVisor column used the same gVisor runtime flags as
`runsc-docker`; the host used for testing only exposes an inner gVisor runtime,
so this is an approximation of the target host.
| Workload | dind under runc | dind under gVisor |
| --- | ---: | ---: |
| 2 GiB write | 2.7 GB/s | 2.4 GB/s |
| 2 GiB read | 18.2 GB/s | 13.6 GB/s |
| 2 GiB memory touch | 1.51 s | 1.94 s |
| BusyBox awk 10M loop | 5.22 s | 5.23 s |
Storage was the full disk-backed volume, not a 5 GiB tmpfs. Nested image builds
and outbound networking worked in both runs.
These are short microbenchmarks; benchmark actual CI images for planning.
Use `--disk-store` instead. It keeps the containerd snapshotter enabled and the
disk-backed volume, and image pulls with file capabilities work. The old
`--no-overlay` mode is retained only for compatibility and is not recommended
for runner images containing files such as `/usr/bin/ping`.
## Networking details
@@ -302,6 +258,5 @@ runner/config.yaml
gvisor/images/basic/docker/Dockerfile
gvisor/images/basic/docker/start-dockerd.sh
dind-runsc/resolv.conf
host/daemon.json.example
scripts/workflow-*.yml
```