Created
September 3, 2020 15:06
-
-
Save ned14/4fc2dac3b7eecfb47ee6cbfbb058c5fb to your computer and use it in GitHub Desktop.
Script to completely reset docker on zfs after Ubuntu zsysd has completely fubared your docker installation
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
# Ubuntu's zsysd creates snapshots within docker's zfs datasets, causing docker | |
# to fail to destroy them, which then completely wrecks the correspondance | |
# between zfs reality, docker's belief of zfs reality, and you are screwed. | |
# These are the commands I used to completely reset docker on zfs so it | |
# could be completely rebuilt. | |
# First things first: get rid of all the autozsys snapshots | |
service zsys stop | |
zfs list -H -o name -t snapshot | grep autozsys | xargs -n1 zfs destroy | |
# Try to persuade docker to remove everything it can | |
docker image prune -a | |
docker ps -a | |
# Remove all datasets created by docker. Do NOT run if you have other legacy zfs datasets! | |
service docker stop | |
zfs list | grep legacy | cut -d ' ' -f 1 | xargs -n1 zfs destroy -r | |
# Remove docker cache of zfs datasets | |
rm -rf /var/lib/docker/image/zfs/layerdb/sha256/* | |
service docker start | |
# You should now be able to completely rebuild your docker containers | |
# from scratch, and it won't error out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment