简体   繁体   中英

Docker push to private registry error [denied: requested access to the resource is denied]

I login like this:

PS C:\workl> docker login some-registry.io -u username@corp.company.com -p somePasswrod 
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded
                                                                                                                                                                

When I run docker images I get this

CREATED = user/custom-images
tag 1 
imageID=34e982156f

I then try to push

docker push user/custom-image:1
The push refers to repository [docker.io/library/custom-image]
50c2af6d2450: Preparing
862d28b9e0d9: Preparing 
...
...
878dab86cf0f: Waiting
denied: requested access to the resource is denied
                                                                                                                                                                                                                                                                                               

Why? I am adding a tag and have seen others online similar to this but don't seem to be able to find a solution. I can pull just fine.

you need to follow this steps to push to a container :

1/ create a repository inside docker hub https://hub.docker.com/repositories :

just click on create a new repository.

2/ tagging your local image:
docker tag /

the repo_name is the one you created in step 1

3/ commit the image :

docker commit <existing-container> <hub-user>/<repo-name>

4/ and finnaly push it :

docker push <hub-user>/<repo-name>

As @altvits said,

If you want to push to some-registry.io you need to tag it like docker image tag image:tag some-registry.io/path/image:tag and push it as docker image push some-registry.io/path/image:tag .

Without tagging the push will attempt to push to the default location which in your case is docker.io

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM