Created
September 22, 2021 21:00
-
-
Save jotafeldmann/2fd1f45d1f1bcf6fcc9d4e9f0afc36dc to your computer and use it in GitHub Desktop.
Docker ZFS removal solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Docker solution for "removal of container X is already in progress" | |
# driver "zfs" failed to remove root filesystem: exit status 1: "/usr/sbin/zfs fs destroy -r rpool/" | |
# Based on https://github.com/moby/moby/issues/40132#issuecomment-570000174 | |
docker ps -a | grep Removal | cut -f1 -d' ' | xargs -rt docker rm 2>&1 >/dev/null | grep "dataset does not exist" | awk '{print $(NF-4)}' | sed "s/'//g" | cut -f1 -d':' | xargs -L1 sh -c 'for arg do sudo zfs destroy -R "$arg"; sudo zfs destroy -R "$arg"-init ; sudo zfs create "$arg" ; sudo zfs create "$arg"-init ; ...; done' _ ; docker ps -a | grep Removal | cut -f1 -d' ' | xargs -rt docker rm 2>&1 >/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment