How the image gc works with virtual size



I’m tracking down a issue that the image gc of the kubelet not working, and found that the imageGCManager could only get the virtual size of the image from docker. This means that, even if we get the target size freed in the gc main loop, there could be less one freed. Because the shared space is not freed but we calc the freed size of the space according to the virtual one. It this a defect?

Another thing is that, if we sum all the image together, the size could much larger than the docker storage, which could trigger a gc. This is not what we want. Do I misunderstand anything?