denied: requested access to the resource is denied


1.vim  /etc/docker/daemon.json    增加一個daemon.json文件

{ "insecure-registries":["192.168.1.100:5000"] }
保存退出

2.重啟docker服務
systemctl daemon-reload
systemctl restart docker

 再做個標記 tag

docker tag SOURCE_IMAGE[:TAG] 192.168.9.xx/docker/IMAGE[:TAG]    此句我解釋下啊, 第一個 SOURCE_IMAGE[:TAG] 就是 REPOSITORY:TAG ; 文件名, 第二個 IMAGE[:TAG] 

  SOURCE_IMAGE[:TAG] 就是 xianwei/vimifconfig:latest  ; IMAGE[:TAG]  就是IMAGE 是自己建一個名字 ,想怎么寫就怎么寫,;[:TAG] 就 是 latest, 如:cnetos:latest 

再上傳,push

docker push 192.168.9.xx/docker/IMAGE[:TAG]

 

[root@PROD-MQ ~]# docker logout 192.168.x.xx    // 退出 Harbor ,這個IP 是 Harbor 服務器的IP,
Removing login credentials for 192.168.9.x
[root@PROD-MQ ~]# docker login 192.168.9.x       // 登錄 Harbor ,這個IP 是 Harbor 服務器的IP,
Username: liuxian   //此用戶名是在 Harbor 上注冊了的用戶名,可以登錄進去的
Password:              //這個密碼肯定就是liuxian 的登錄密碼了;
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@PROD-MQ ~]# docker push 192.168.9.52/docker/vimifconfig:latest    //再進行PUSH ,就會成功啦
The push refers to repository [192.168.9.52/docker/vimifconfig]
9b09ff32b149: Pushed    //傳輸完成
a1ec00a0e6d0: Pushed  //傳輸完成
071d8bd76517: Pushed  //傳輸完成
latest: digest: sha256:90b98dd0bcb65a740276d2b826e893848df5e655f1381b5d95badf5f8ec63bc7 size: 953     //最后成功上傳完成。
[root@PROD-MQ ~]#

 

第二個問題是:Get https://192.168.2.119/v2/: dial tcp 192.168.2.119:443: getsockopt: connection refused

原因:沒有指定鏡像要上傳的地址,站點。默認的是docker.io

解決方法:docker tag <imagesname> <ip:port/image>

                  docker push ip:port/image 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM