Initial Docker overlay2 support

- override filesystem type to overlay2 if `DOCKER_BACKINGFS` in docker.cfg is set to `overlay2`
This commit is contained in:
Christoph Hummer
2024-07-15 17:40:10 +02:00
committed by GitHub
parent bbed6047e3
commit 30492ed2f2
+11 -7
View File
@@ -58,14 +58,18 @@ if [[ -f $DOCKER_CFG ]]; then
. $DOCKER_CFG
fi
# Set storage driver appropriate for backing filesystem, override user setting
BACKINGFS=$(findmnt --output FSTYPE --noheadings $DOCKER_ROOT)
if [[ $BACKINGFS == btrfs ]]; then
DOCKER_OPTS="$DOCKER_OPTS --storage-driver=btrfs"
elif [[ $BACKINGFS == xfs ]]; then
# set storage driver to overlay2 if config value is found, otherwise fall back to native FS driver
if [[ $(awk -F'"' '/^DOCKER_BACKINGFS=/{print $2}' $DOCKER_CFG 2>/dev/null) == overlay2 ]]; then
DOCKER_OPTS="$DOCKER_OPTS --storage-driver=overlay2"
elif [[ $BACKINGFS == zfs ]]; then
DOCKER_OPTS="$DOCKER_OPTS --storage-driver=zfs"
else
BACKINGFS=$(findmnt --output FSTYPE --noheadings $DOCKER_ROOT)
if [[ $BACKINGFS == btrfs ]]; then
DOCKER_OPTS="$DOCKER_OPTS --storage-driver=btrfs"
elif [[ $BACKINGFS == xfs ]]; then
DOCKER_OPTS="$DOCKER_OPTS --storage-driver=overlay2"
elif [[ $BACKINGFS == zfs ]]; then
DOCKER_OPTS="$DOCKER_OPTS --storage-driver=zfs"
fi
fi
# Less verbose logging by default