docs icon indicating copy to clipboard operation
docs copied to clipboard

Add mention/tip about FROM scratch to docs/storage/storagedriver/vfs-driver.md.

Open icaine opened this issue 3 years ago • 0 comments

Problem description

The above output shows that three layers each take 104M and two take 125M. These directories have only small differences from each other, but take up nearly the same amount of room on disk. This is one of the disadvantages of using the vfs storage driver.

After this paragraph at https://docs.docker.com/storage/storagedriver/vfs-driver/ there should be mentioned how to reduce the number of layers and thus reduce the size of the vfs folder. The solution is almost trivial, yet it took me hours to find.

The solution seems to be to use FROM scratch followed by COPY --from=0 / / at the end of Dockerfile and after the image is built, to run docker image prune.

I create this issue because i am not sure if this solution does not have some side effects, but if not, it definitely should be mentioned as whole somewhere.

Thank you.

icaine avatar Oct 03 '22 14:10 icaine