1
0
mirror of https://github.com/home-assistant/operating-system.git synced 2026-02-22 10:46:38 +00:00
Files
Jan Čermák af9131cd10 Use Docker containerd snapshotter for new and wiped installs (#4360)
Prefer the containerd snapshotter by using it by default for new installs and
when no Docker data is present (e.g. after datadisk wipe). The snapshotter is
enabled by a dockerd flag which is set when a flag file is present in the data
partition. This flag file can be used also to opt-in for this snapshotter on
legacy installs (high level API through OS Agent and Supervisor TBD), to
migrate to the containerd snapshotter this file can be simply created manually.

Testing shown no major problems when migrating, the old overlay2 folder can be
(and should be - to avoid situations where the data disk might run out of
space) deleted before the docker.service is started in the docker-prepare
script.

Note that there's no offline migration path, OS needs to be connected to the
internet to re-download the images when migrating. This could be theoretically
possible through docker image save/load functions but guarding for enough of
space and other edge cases would be probably too complex to justify it.

Refs #4252
Refs #4253 - easier opt-in method is still needed
Closes #4254 - migration is handled seamlessly by Docker
2025-10-28 18:36:48 +01:00

24 lines
728 B
Bash
Executable File

#!/bin/sh
set -e
if [ ! -d /mnt/data/docker ] || [ -z "$(ls -A /mnt/data/docker)" ]; then
echo "[INFO] Docker data is wiped, creating containerd snapshotter flag"
touch /mnt/data/.docker-use-containerd-snapshotter
fi
DOCKERD_FLAGS=""
if [ -f /mnt/data/.docker-use-containerd-snapshotter ]; then
echo "[INFO] Using Docker containerd snapshotter"
DOCKERD_FLAGS="${DOCKERD_FLAGS} --feature containerd-snapshotter"
if [ -d /mnt/data/docker/overlay2 ]; then
echo "[INFO] Removing no longer used overlay2 directory"
# Allow the removal to fail without failing the service
rm -rf /mnt/data/docker/overlay2 || true
fi
fi
echo "DOCKERD_FLAGS=\"${DOCKERD_FLAGS}\"" > /run/dockerd.env