Output statement is not consistent when push image at dockerhub I'm really curious

Sometimes ‘Mounted from’ is printed and sometimes ‘Pushed’ is printed.

Why is ‘cross repository blob mount’ not applied consistently?

I’m sorry for not being good at English.

“Mounted from” indicates the image layer already exists in “diamol/ch03-web-ping” and therefor doesn’t need to be pushed.

The docker client does not push images as a single file upload. It pushes image layers, and a manifest that provides a list and order of image layers that make up the image.

I understand your reply. But i have some question.
I pushed same image fivetimes. five prints are all defferent(Pushed, Mounted from). I expect that same image pushed, same result print.
I want to know Why they are deffernt?

The resulting image layers available on Dockerhub must be the same, if the same tag was pushed once or more - that is if it hasn’t been rebuild between pushes. Only the metadata will be affected by change. Why would you expect the output of docker push to be identical in repeated pushes for the same image (=same image layers)?

I can only repeat myself: image layer that exist are not pushed again, this is what makes working with docker images to efficient.

Each instruction in a Dockerfile will create a new image layer. Now let’s assume at the bottom of your Dockerfile you use the COPY instruction to copy artifacts into the image.

As a result, would you expect that every image layer is rebuild? Or would you expect that unchanged layers are reused, and only the changed image layers are generated? It is the later case and the reason only image layers that don’t already exist on Dockerhub are pushed.

I pushed and erased repeatedly.
Therefore, I knew that the mounted layer would continue to be mounted. However sometimes Pushed, sometimes Mounted same layer.
The photo in the text is that result.

I didn’t say that I repeated push and delete. sorry

i don’t understand until now :sob:

I got that…

Obviously I failed to enable you to understand it. I have no idea what else to tell you.
Thus said, I hope someone else will pick it up and explain it a more suited way than I tried to do.

Your explanation was perfect.
Rather, I was not good at English, so I couldn’t ask the question properly.
sorry. and thank you for your answer

Then don’t describe the question, show the commands in code blocks that you used so we can reproduce the behavior :slight_smile: I show you an example

docker build . -t diamol/ch03-web-ping
docker push diamol/ch03-web-ping
docker image rm diamol/ch03-web-ping

docker build . -t diamol/ch03-web-ping
docker push diamol/ch03-web-ping
docker image rm diamol/ch03-web-ping

docker build . -t diamol/ch03-web-ping
docker push diamol/ch03-web-ping
docker image rm diamol/ch03-web-ping

docker build . -t diamol/ch03-web-ping
docker push diamol/ch03-web-ping
docker image rm diamol/ch03-web-ping

docker build . -t diamol/ch03-web-ping
docker push diamol/ch03-web-ping
docker image rm diamol/ch03-web-ping

Or assuming you deleted the image on Docker hub and not on your machine

docker build . -t diamol/ch03-web-ping

docker push diamol/ch03-web-ping
# docker hub web interface -> delete image

docker push diamol/ch03-web-ping
# docker hub web interface -> delete image

docker push diamol/ch03-web-ping
# docker hub web interface -> delete image

docker push diamol/ch03-web-ping
# docker hub web interface -> delete image

docker push diamol/ch03-web-ping
# docker hub web interface -> delete image

If you could also show the five outputs, that would be great as well.

Your screenshot in your first post shows only that your second push behaved as it was expected. Although I have never tried something like that, but I could imagine that deleting an image on Docker Hub and quickly pushing the image again sometimes happens quicker than Docker Hub could actually delete all the layers and sometimes the layer still exists and pushing the image cancels the delete operation. Other times the layer had already been deleted so it is pushed again.

It is also possible that the output is actually not consistent sometimes. I don’t really care usually if the output is pushed or mounted, but now that you shared your question, I think I have seen something similar before. I am not sure about that since I rarely push images manually to Docker Hub.

The second block of code is what I did.
I pushed the same image under the same condition
But sometimes it mounts for the same layer and sometimes it fails.
I wonder why.
And diamol/ch03-web-ping is not an image in my registry
It is not an image created by me, but there is a layer among those images that overlaps with my image

I just realized I copied the wrong image tags in my example.

It is not likely that docker build on your machine results the same layers as the layers in the diamol repositories so the layers of diamol/node , should be always mounted and the rest pushed. If not, that can indeed be inconsistent behavior but I wouldn’t worry about that.

first push

The push refers to repository [docker.io/howl201/log]
5e669416c853: Pushed
bce3cf394afb: Pushed
d9135aebc096: Pushed
109c4a769edd: Mounted from diamol/ch03-web-ping
04db5bd8a39f: Mounted from diamol/ch03-web-ping
eaa2fd82d1ac: Mounted from diamol/ch03-web-ping
f1b5933fe4b5: Mounted from diamol/ch03-web-ping
v1: digest: sha256:faa1cfb8cbdec88f11fc91027ea417c3b04c9fbd7a84b7db66b4a61c48f24393 size: 1783

delete image at Docker hub and push again

The push refers to repository [docker.io/howl201/log]
5e669416c853: Pushed
bce3cf394afb: Pushed
d9135aebc096: Pushed
109c4a769edd: Pushed
04db5bd8a39f: Mounted from diamol/ch03-web-ping
eaa2fd82d1ac: Mounted from diamol/ch03-web-ping
f1b5933fe4b5: Mounted from diamol/ch03-web-ping
v1: digest: sha256:faa1cfb8cbdec88f11fc91027ea417c3b04c9fbd7a84b7db66b4a61c48f24393 size: 1783

‘109c4a769edd’ This layer was mounted the first time, but not the second time.
I wonder why this is

Are you saying that this can happen and I don’t have to worry about it?

Yes, I am saying that. :slight_smile: I don’t know why it happens but I am sure this is just how the client shows the status. Everything that needs to be pushed, will be pushed. And everything that is already on Docker Hub, will not be pushed.

After all, it is an event inside Docker, so there are many unknown variables.
I understand. thank you for your kindness.
I don’t know Hungarian but from today I will watch your youtube

I have an English channel as well. I changed my profile. You can find the link there.

1 Like