5-2 registry实战

搜索镜像

docker search whalesay

拉镜像

docker pull docker/whalesay

docker images

docker run docker/whalesay cowsay Docker很好玩!

docker tag docker/whalesay hlg/whalesay

一模一样 只是名字不一样

docker push hlg/whalesay

网站打不开

https://hub.docker.com/

第二天网站可以访问了

denied: requested access to the resource is denied

登录

docker login

docker push hlg/whalesay
denied: requested access to the resource is denied

原因:

push时即使账户密码正确也显示 [denied: requested access to the resource is denied]的问题
这里要注意一个问题,给自己镜像命名的时候格式应该是: docker注册用户名/镜像名,比如我的docker用户名为 test123,那么我的镜像tag就为 test123/whalesay,不然是push不上去的
docker push huanglianggu/whalesay

图示:

Xshell 5 (Build 0537)
Copyright (c) 2002-2014 NetSarang Computer, Inc. All rights reserved.

Type `help' to learn how to use Xshell prompt.
[c:\~]$ 

Connecting to 118.31.36.138:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-135-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch
New release '20.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


Welcome to Alibaba Cloud Elastic Compute Service !

Last login: Thu Mar 25 18:18:15 2021 from 116.233.210.70
root@iZbp1berl2oy3e3vt5476fZ:~# docker search whalesay
NAME                           DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
docker/whalesay                An image for use in the Docker demo tutorial    693                  
nikovirtala/whalesay           Tiny Go web service to print Moby Dock ASCII…   1                    [OK]
ojenge/whalesay                from docker/whalesay                            1                    
swinton/whalesay               whalesay, innit                                 1                    
milanfort/whalesay             Modified docker/whalesay image that outputs …   1                    
sabs1117/whalesay              Whalesay with fortune phrases.                  1                    
caibar/whalesay                Builds automatizados.                           1                    [OK]
forsingh/whalesay              whalesay                                        0                    [OK]
getporter/whalesay                                                             0                    
yang225217/whalesay                                                            0                    
firecyberice/whalesay          Docker **Cloud** automated build for **amd64…   0                    
dhalljohnston/whalesay         whalesay                                        0                    
whalebrew/whalesay                                                             0                    
blaines/whalesay                                                               0                    
gapfish/whalesay-ruby          whalesay function test                          0                    
nikovirtala/whalesay-win       Whalesay running on Microsoft IIS on Nano Se…   0                    [OK]
carolynvs/whalesayd                                                            0                    
hongxi/whalesay-fortunes       Demo, the whalesay-fortunes                     0                    
dockeramiller/whalesay         Modified version of the official docker/whal…   0                    [OK]
getporter/whalesay-installer                                                   0                    
maghnus/whalesayentrypoint     I need a version of whalesay with entrypoint…   0                    
ox0spy/whalesay-fortune        like docker/whalesay, just using fortunes pr…   0                    
burleyinnersbm07/whalesay      Edit to the WhaleSay                            0                    
phyominhtun/whalesay           WhaleSay Container                              0                    
tpei/whalesay-crystal          crystal faas demo function                      0                    
root@iZbp1berl2oy3e3vt5476fZ:~# docker pull docker/whalesay
Using default tag: latest
latest: Pulling from docker/whalesay
Image docker.io/docker/whalesay:latest uses outdated schema1 manifest format. Please upgrade to a schema2 image for better future compatibility. More information at https://docs.docker.com/registry/spec/deprecated-schema-v1/
e190868d63f8: Already exists 
909cd34c6fd7: Already exists 
0b9bfabab7c1: Already exists 
a3ed95caeb02: Already exists 
00bf65475aba: Already exists 
c57b6bcc83e3: Already exists 
8978f6879e2f: Already exists 
8eed3712d2cf: Already exists 
Digest: sha256:178598e51a26abbc958b8a2e48825c90bc22e641de3d31e18aaf55f3258ba93b
Status: Image is up to date for docker/whalesay:latest
docker.io/docker/whalesay:latest
root@iZbp1berl2oy3e3vt5476fZ:~# docker images
REPOSITORY         TAG       IMAGE ID       CREATED       SIZE
root/hello-nginx   latest    795b366fe48d   2 days ago    160MB
hello_docker       latest    71256a536e16   2 days ago    5.61MB
<none>             <none>    8a688aaab432   2 days ago    5.61MB
nginx-fun-hlg      latest    1d0b6ec5c36a   2 days ago    133MB
nginx              latest    6084105296a9   12 days ago   133MB
ubuntu             latest    4dd97cefde62   3 weeks ago   72.9MB
alpine             latest    28f6e2705743   5 weeks ago   5.61MB
docker/whalesay    latest    6b362a9f73eb   5 years ago   247MB
hlg/whalesay       latest    6b362a9f73eb   5 years ago   247MB
root@iZbp1berl2oy3e3vt5476fZ:~# docker run docker/whalesay cowsay 今天很好玩
 _________________ 
< 今天很好玩 >
 ----------------- 
    \
     \
      \     
                    ##        .            
              ## ## ##       ==            
           ## ## ## ##      ===            
       /""""""""""""""""___/ ===        
  ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~   
       \______ o          __/            
        \    \        __/             
          \____\______/   
root@iZbp1berl2oy3e3vt5476fZ:~# docker tag docker/whalesay hlg/whalesay
root@iZbp1berl2oy3e3vt5476fZ:~# docker images
REPOSITORY         TAG       IMAGE ID       CREATED       SIZE
root/hello-nginx   latest    795b366fe48d   2 days ago    160MB
hello_docker       latest    71256a536e16   2 days ago    5.61MB
<none>             <none>    8a688aaab432   2 days ago    5.61MB
nginx-fun-hlg      latest    1d0b6ec5c36a   2 days ago    133MB
nginx              latest    6084105296a9   12 days ago   133MB
ubuntu             latest    4dd97cefde62   3 weeks ago   72.9MB
alpine             latest    28f6e2705743   5 weeks ago   5.61MB
docker/whalesay    latest    6b362a9f73eb   5 years ago   247MB
hlg/whalesay       latest    6b362a9f73eb   5 years ago   247MB
root@iZbp1berl2oy3e3vt5476fZ:~# docker push hlg/whalesay
Using default tag: latest
The push refers to repository [docker.io/hlg/whalesay]
5f70bf18a086: Preparing 
d061ee1340ec: Preparing 
d511ed9e12e1: Preparing 
091abc5148e4: Preparing 
b26122d57afa: Preparing 
37ee47034d9b: Waiting 
528c8710fd95: Waiting 
1154ba695078: Waiting 
denied: requested access to the resource is denied
root@iZbp1berl2oy3e3vt5476fZ:~# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: huanglinaggu^H^H^H^H^H
Password: 
Error: Password Required
root@iZbp1berl2oy3e3vt5476fZ:~# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: huanglianggu
Password: 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
root@iZbp1berl2oy3e3vt5476fZ:~# docker push hlg/whalesay
Using default tag: latest
The push refers to repository [docker.io/hlg/whalesay]
5f70bf18a086: Preparing 
d061ee1340ec: Preparing 
d511ed9e12e1: Preparing 
091abc5148e4: Preparing 
b26122d57afa: Preparing 
37ee47034d9b: Waiting 
528c8710fd95: Waiting 
1154ba695078: Waiting 
denied: requested access to the resource is denied
root@iZbp1berl2oy3e3vt5476fZ:~# docker login
Authenticating with existing credentials...
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
root@iZbp1berl2oy3e3vt5476fZ:~# docker push hlg/whalesay
Using default tag: latest
The push refers to repository [docker.io/hlg/whalesay]
5f70bf18a086: Preparing 
d061ee1340ec: Preparing 
d511ed9e12e1: Preparing 
091abc5148e4: Preparing 
b26122d57afa: Preparing 
37ee47034d9b: Waiting 
528c8710fd95: Waiting 
1154ba695078: Waiting 
denied: requested access to the resource is denied
root@iZbp1berl2oy3e3vt5476fZ:~# docker tag docker/whalesay huanglianggu/whalesay
root@iZbp1berl2oy3e3vt5476fZ:~# docker images
REPOSITORY              TAG       IMAGE ID       CREATED       SIZE
root/hello-nginx        latest    795b366fe48d   2 days ago    160MB
hello_docker            latest    71256a536e16   2 days ago    5.61MB
<none>                  <none>    8a688aaab432   2 days ago    5.61MB
nginx-fun-hlg           latest    1d0b6ec5c36a   2 days ago    133MB
nginx                   latest    6084105296a9   12 days ago   133MB
ubuntu                  latest    4dd97cefde62   3 weeks ago   72.9MB
alpine                  latest    28f6e2705743   5 weeks ago   5.61MB
docker/whalesay         latest    6b362a9f73eb   5 years ago   247MB
hlg/whalesay            latest    6b362a9f73eb   5 years ago   247MB
huanglianggu/whalesay   latest    6b362a9f73eb   5 years ago   247MB
root@iZbp1berl2oy3e3vt5476fZ:~# docker push huanglianggu/whalesay
Using default tag: latest
The push refers to repository [docker.io/huanglianggu/whalesay]
5f70bf18a086: Pushed 
d061ee1340ec: Pushed 
d511ed9e12e1: Pushed 
091abc5148e4: Pushed 
b26122d57afa: Pushed 
37ee47034d9b: Pushed 
528c8710fd95: Pushed 
1154ba695078: Pushed 
latest: digest: sha256:df326a383b4a036fd5a33402248027d1c972954622924158a28744ed5f9fca1e size: 2402
root@iZbp1berl2oy3e3vt5476fZ:~#

猜你喜欢

转载自blog.csdn.net/huanglianggu/article/details/115187865
5-2