Docker Community Forums

Share and learn in the Docker community.

Why docker push stores the whole image?

Hi there, sorry for the newbie question (using docker since a week ago).
So, why does docker pushes the whole image instead of just pushing the Dockerfile and leverages on use resources of the pulling user ?

Good evening,

often you can find the a project’s Dockerfile somewhere on GitHub - so you are still able to build the image on your own.
And usually building an image based on a Dockerfile should give the same results as pulling it from DockerHub.

…sometimes you need additional ressources to be added from the computer where the image is created but are not available at your computer.
…sometimes a Dockerfile ADDs additional files which are needed during a multi-stage build-process but don’t need to be present in the resulting image.
…sometimes packages are not available anymore in a linux-repository (maybe because of license-problems or some other issues?) so build-ing the image again with only the Dockerfile will fail - but pull-ing the completely (and successfully) built image is still working.
…in my case I build the images on a computer with internet-access, then push them to a private registry and later I can pull them on a computer without internet-access and only access to the private registry and the image is still working.

These are some reasons which came to my mind - there might be many others.

1 Like