diff --git a/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh b/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh index 2fc8ccd3..60306718 100644 --- a/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh +++ b/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh @@ -50,13 +50,28 @@ fi # so that in particular what is mounted at '/' is output before other stuff. read_filesystems_command="$read_filesystems_command | sort -t ' ' -k 1,1 -u" -# docker daemon mounts file systems for its docker containers -# see also https://docs.docker.com/storage/storagedriver/device-mapper-driver/#configure-direct-lvm-mode-for-production -# As it is for container usage only we do not to backup these up or recreate as this disk device is completely under -# control by docker itself (even the recreation of it incl, the creation of the volume group). Usually this is -# done via a kind of cookbook (Chef, puppet or ansible) +# The Docker daemon mounts file systems for its Docker containers, see also +# https://docs.docker.com/storage/storagedriver/device-mapper-driver/#configure-direct-lvm-mode-for-production +# As it is for container usage only we do not to backup these up or recreate as this disk device is completely +# under control by Docker itself (even the recreation of it incl, the creation of the volume group). +# Usually this is done via a kind of cookbook (Chef, puppet or ansible). docker_is_running="" -service docker status >/dev/null 2>&1 && docker_is_running="yes" +docker_root_dir="" +if service docker status &>/dev/null ; then + docker_is_running="yes" + # When the Docker daemon/service is running, try to get its 'Docker Root Dir': + # Kill 'docker info' with SIGTERM after 5 seconds and with SIGKILL after additional 2 seconds + # because there are too many crippled Docker installations, cf. https://github.com/rear/rear/pull/2021 + docker_root_dir=$( timeout -k 2s 5s docker info | grep 'Docker Root Dir' | awk '{print $4}' ) + # Things may go wrong in the 'Docker specific exclude part' below + # when Docker is used but its 'Docker Root Dir' cannot be determined + # cf. https://github.com/rear/rear/issues/1989 + if test "$docker_root_dir" ; then + LogPrint "Docker is running, skipping filesystems mounted below Docker Root Dir $docker_root_dir" + else + LogPrintError "Cannot determine Docker Root Dir - things may go wrong - check $DISKLAYOUT_FILE" + fi +fi # Begin writing output to DISKLAYOUT_FILE: ( @@ -64,9 +79,10 @@ service docker status >/dev/null 2>&1 && docker_is_running="yes" echo "# Format: fs [uuid=] [label=