问题
I googled and saw this but I don't know what it is saying about image tags, etc: link
I am trying to complete the tutorial here: tutorial official Docker
Here is my output for docker images
nobu@nobu-ThinkPad-T420:~/docker/docker-curriculum/flask-app$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
prakhar1989/catnip latest 517dbced092c About an hour ago 700MB
nginx latest 06144b287844 2 weeks ago 109MB
busybox latest e1ddd7948a1c 7 weeks ago 1.16MB
prakhar1989/catnip <none> c984660fe008 7 weeks ago 700MB
hello-world latest 2cb0d9787c4d 2 months ago 1.85kB
python 3-onbuild 292ed8dee366 2 months ago 691MB
prakhar1989/static-site latest f01030e1dcf3 2 years ago 134MB
What I don't understand is which column above shows the image name? I see a column for repo and then for ID but neither seems to fit the bill and the tutorial skips over this key piece of info.
I was able to run the app on localhost:8888
.
I don't know why I am getting:
nobu@nobu-ThinkPad-T420:~/docker/docker-curriculum/flask-app$ docker push prakhar1989/catnip
The push refers to repository [docker.io/prakhar1989/catnip]
f438d02b6568: Preparing
0a0917397206: Preparing
b24e1ed3eb49: Preparing
29778035860f: Preparing
fc88d2431f4d: Preparing
1dc1b82fa010: Waiting
09e3fd9cf357: Waiting
138d1921c15b: Waiting
d714f65bc280: Waiting
fd6060e25706: Waiting
d7ed640784f1: Waiting
1618a71a1198: Waiting
denied: requested access to the resource is denied
I have an account on Docker Hub and set up a public repository. Can someone give me hints on what command I need to enter to push this?
回答1:
Here is a common mistake I make, thought this might help someone.
Make sure you are consistent in using sudo
across login and push. .i.e:
docker login
should always be followed bydocker push
andsudo docker login
should always be followed bysudo docker push
This is because of the config for sudo docker
and docker
are different files in the system.
回答2:
This is happening because your docker hub account is not login in your terminal
First login your docker account by using following command
sudo docker login
username: your username
password : your password
Second push your local repository into docker hub by using following command
sudo docker tag local-image:tagname reponame:tag
sudo docker push reponame:tag
eg. sudo docker tag tagId dockerdemo:latest
sudo docker push dockerdemo:latest
回答3:
Ok, so the creator of the tutorial forgot to mention we have to tag the image first with docker tag {image ID number} yourhubusername/{name_of_your_choice]:firsttry
where :firsttry
is a tag (I'll post photos below).
Here is the terminal output from the above tagging and then docker push
nobu@nobu-ThinkPad-T420:~/docker/docker-curriculum/flask-app$ docker tag 0690a67d2358 hockeymonkey96/catnip:firsttry
nobu@nobu-ThinkPad-T420:~/docker/docker-curriculum/flask-app$ docker push hockeymonkey96/catnip
The push refers to repository [docker.io/hockeymonkey96/catnip]
9da301382602: Pushed
40a74dab97c5: Pushed
d27f618acc37: Pushed
29778035860f: Mounted from prakhar1989/catnip
fc88d2431f4d: Mounted from prakhar1989/catnip
1dc1b82fa010: Mounted from prakhar1989/catnip
09e3fd9cf357: Mounted from prakhar1989/catnip
138d1921c15b: Mounted from prakhar1989/catnip
d714f65bc280: Mounted from prakhar1989/catnip
fd6060e25706: Mounted from prakhar1989/catnip
d7ed640784f1: Mounted from prakhar1989/catnip
1618a71a1198: Mounted from prakhar1989/catnip
firsttry: digest: sha256:39193977dfe6474d77127aea2b249105669d0683988a3c7043ac66eb2264141e size: 2840
Now when I look at Docker Hub, I can see it:
And that :firsttry
tag is here:
来源:https://stackoverflow.com/questions/52454188/how-to-overcome-access-to-resource-denied-for-docker-push-in-official-tutorial