Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does "docker push" push several images and where?

I have private repo on docker hub named alek/test. On my Mac:

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
alek/test           0.1                 dc1a7cc41129        33 minutes ago      643 MB
node                0.12.7              9e20baae42c8        5 days ago          641.6 MB

$ docker push alek/test
The push refers to a repository [docker.io/alek/test] (len: 1)
dc1a7cc41129: Image successfully pushed 
537a913fe639: Image successfully pushed 
b40236e9037f: Image successfully pushed 
53c8b1d50397: Image successfully pushed 
e8c37c1e2189: Image successfully pushed 
68bbfd9543a7: Image successfully pushed 
9e20baae42c8: Image already exists 
8b74d7a75802: Image successfully pushed 
3383909e8f95: Image already exists 
e0919a8b95a8: Image already exists 
6ad0799af6bd: Image successfully pushed 
9213e81cb0f2: Image successfully pushed 
607e965985c1: Image successfully pushed 
1ff9f26f09fb: Image successfully pushed 
9a61b6b1315e: Image already exists 
902b87aaaec9: Image successfully pushed 
0.1: digest: sha256:a2b1d8a3b283f13e8d6a1407e886ca8ee62d93377949e050b9e05509ce6aaf86 size: 30568

What just have happened??? Why several images have been pushed? Also where they were actually pushed - nothing changed on my private repo on docker hub (screen).

enter image description here

I am not sure If I understand docker hub correctly. What I want is to build image from Dockerfile and push it to my repo to make it available for a client to pull it on his side and run in container...

like image 344
user606521 Avatar asked Aug 12 '15 10:08

user606521


1 Answers

You understand correctly.

There is an image for each layer in the image, corresponding to each instruction in a Dockerfile. Docker pushes these layers independently.

As you didn't specify a tag, Docker will push all the tags in the repository (in this case just 0.1). Anyone with access to your repository should be able to download it with docker pull alek/test:0.1. If you look at the tags tab on the Hub, you should see your images there.

If you do a docker push without a tag, I think it pushes the whole repo - i.e. all the images. If you do docker run or docker pull without a tag, it will use the latest tag. So I assume the 0.1 tag got pushed in your case, but you would need to say docker pull alek/test:0.1 to pull it.

like image 164
Adrian Mouat Avatar answered Sep 23 '22 00:09

Adrian Mouat