问题原文
原帖链接 · user1726453 · CC BY-SA 3.0
I have container running GlassFish. When I tried commit a image , it became 14GB. Later, I deleted /tmp/ in the container which was 10GB and tried to commit a image, but still the image is 14GB. It seems that deleting files from the container is not reflected in the image size. How do I fix this issue?
社区高分解答
原帖链接 · Juan Antonio Galán Martínez · CC BY-SA 3.0
The problem that you might be facing is that removing files in a commit does not change the fact that the file was there in a previous image, so that previous image is still 14G.
Have a look at the "Layers" part in this article: http://woudenberg.io/reducing-docker-image-size/
To solve that issue you need to remove the things under /tmp/ within the original commit that generated them, so the image created as a result of that commit does not include them. That is easy when use dockerfiles but not sure if possible when creating images with commits.
Another thing you may be able to do is squash layers by exporting/importing the image.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
