Skip to content

Instantly share code, notes, and snippets.

@tbnorth
Created October 3, 2022 14:17
Show Gist options
  • Save tbnorth/676de940034a4284e65ff2dec8253d81 to your computer and use it in GitHub Desktop.
Save tbnorth/676de940034a4284e65ff2dec8253d81 to your computer and use it in GitHub Desktop.
# Fix ERROR: readlink /data/docker/overlay2/l/7M5EN7M5OUETAW42LC63NZBNJA: no such file or directory errors
docker image ls | while read row; do
image_id=$(echo $row | sed -E 's/^(\S+\s+){2}(\S+).*/\2/')
docker inspect --format='{{.GraphDriver.Data.MergedDir}}' $image_id || \
(echo -e "Broken image:\n$row"; echo docker image rm $image_id)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment