简体   繁体   中英

Find to which container or image a docker AUFS diff folder belongs to

Does anyone knows how to find to which docker container, image or volume an AUFS diff folder belongs?

I have a legacy file like this

/var/lib/docker/aufs/diff/d4f388f19d7b4e8e9eef2a4ae5630f87d59180263482fbc63dbe7d31b6c0fc5b/usr/lib/gcc/x86_64-linux-gnu/6/cc1

There's no container, volume or image with this ID d4f388f19d7b

I tried to find it inspecting each container, volume and image using the ID d4f388f19d7b but no luck

for c in $(docker ps -q) ; do docker inspect $c | grep d4f388f19d7b ; done
empty response

for i in $(docker images -q) ; do docker image inspect $i | grep d4f388f19d7b ; done
empty response

for v in $(docker volume ls -q) ; do docker volume inspect $v | grep d4f388f19d7b ; done
empty response

Is there an easy way to identify which docker container/volume/image owns this file? lsof shows that the file is not in use as it's a legacy file last time accessed was 3 months ago.

I am out of ideas

I found the way to map a diff folder to a container

grep DIFF_FOLDER_ID /var/lib/docker/image/aufs/layerdb/mounts/*/mount-id

it will give you the container ID, if you get empty output it means is orphaned or it belongs to a docker image

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM