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

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).
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...

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.

Related

Incorrectly pushed docker image to dockerhub. How to delete?

I was intending to push docker images to a private repo in azure.
However, I was logged in my to Dockerhub account when I carelessly pushed the image with tagname in azure repo format (e.g. myprivaterepo.azurecr.io/myfolder/myimage:0.0.4).
How do I delete this image?
When I login to another PC, and login to dockerhub, I can pull this exact version from the command line.
My Dockerhub web page only allows me to view repositories under my Dockerhub account.
"myimage" does not appear inside my Dockerhub Repositories list.
I also can't view other repositories inside Dockerhub. Please help! Thanks!
Go to repository section of your docker hub account home page
Check if image is available
If image available go inside it and select from left checkbox and delete the image
If image is not available , then mostly it is only in you local system , you can prune the images from your local system using: docker image prune command or directly remove image using: docker rmi

Docker pull: still having old image after pull

I noticed that the docker image I'm using is older than the one on dockerhub. Running docker pull seems to work, but later when running docker images I still see the old image, even if I first explicitly removed it with docker rmi.
Output of docker pull:
# docker pull staltz/ssb-room
Using default tag: latest
latest: Pulling from staltz/ssb-room
9a0b0ce99936: Already exists
db3b6004c61a: Already exists
f8f075920295: Already exists
6ef14aff1139: Already exists
0bbd8b48260f: Pull complete
524be717efb1: Pull complete
aad1e8812bc2: Pull complete
13fb072986db: Pull complete
627a2df19018: Pull complete
fb8dcb3732a4: Pull complete
2bc41d47dd50: Pull complete
058f4db9be8e: Pull complete
8f21c57f425d: Pull complete
Digest: sha256:a7c49c796823312f8c1d155eb636bbd974bc55036c2180f16f17d3340fcebbe7
Status: Downloaded newer image for staltz/ssb-room:latest
docker.io/staltz/ssb-room:latest
Output of docker images:
# docker images staltz/ssb-room
REPOSITORY TAG IMAGE ID CREATED SIZE
staltz/ssb-room latest 6097b401900c 4 months ago 930MB
Why is it again showing that 4-months old image?

Why can't I push local Docker image to Docker Hub repo?

I have Docker ID, let's say -> KN, and created a private repo. I can log into Docker Hub via CLI too. I run a container based on a image & commit that container to an image with following command
docker commit ub18 reponame/ub18 ==> successfull
but when I push that image like following, it doesn't upload.
Output of Docker images shows this image on top.
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
standard/ub18 latest c8ebc0f1dd75 12 seconds ago 102MB
docker push reponame/ub18 ==> gives error
The push refers to repository [docker.io/standard/ub18]
7660ded5319c: Preparing
94e5c4ea5da6: Preparing
5d74a98c48bc: Preparing
604cbde1a4c8: Preparing
denied: requested access to the resource is denied
So to push your images to your Docker Hub repo first you have to login to Docker Hub repo using username and password:
docker login
Then perform tagging of your image properly :
docker tag image_id yourhubusername/reponame:tag
Your image tag has to be in this specific format.
Then to push :
docker push yourhubusername/reponame:tag
assuming you are logged in.
If you want to gain more information about it, refer to docker docs.

docker pull returning image not found

docker pull localhost:21518/master:latest
Getting following response:
Trying to pull repository localhost:21518/master ...
Pulling repository localhost:21518/master
Error: image master:latest not found
Whereas docker images returns
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost:21518/master latest e9f29fbf9931 6 hours ago 703 MB
Why image is not getting pulled?
docker images shows the list of cached images and not repository images. I got confused that docker images showing images from repository as repository is also running on local machine.
Needed to do docker push to get image in repository.

Docker push local image under specified tag name

I need to push Docker image from my local machine to my https://hub.docker.com repository under the specified tag name.
Locally I have the following image:
REPOSITORY TAG IMAGE ID CREATED SIZE
repo1/private image1 29234rs8dsf 5 months ago 1.07GB
Hot to push this image under the specified tag(not latest, for example, testtag1) under my https://hub.docker.com repository inttest/myimage ?
If i understood the question correctly, you can do it with following 3 steps -
TAG your local image to dockerhub repo image -
$ docker tag repo1/private:image1 inttest/myimage:testtag1
Login to your dockerhub account using docker login
Push your dockerhub repo tagged image -
$ docker push inttest/myimage:testtag1

Resources