Created
January 6, 2026 19:38
-
-
Save cgmb/79c1804590a7a7a5a926b6d699b930ff to your computer and use it in GitHub Desktop.
Bash functions for identifying containers by files in root
This file contains hidden or 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
| function docker-files { | |
| docker diff "$1" | cut -d/ -f2,3 | fgrep 'root/' | grep -v 'root/\.' | sed 's_root/__' | uniq | |
| } | |
| function docker-files-all { | |
| local container_ids=$(docker ps -a | cut -d' ' -f1 | sed -n '1d;p') | |
| for container_id in $container_ids; do | |
| echo "$container_id:" | |
| docker-files "$container_id" | sed 's/^/ /' | |
| done | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment