denied: requested access to the resource is denied

Posted 我的梦想是:带着我老婆叶云霞--Travel around

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 

 

以上是关于denied: requested access to the resource is denied的主要内容,如果未能解决你的问题,请参考以下文章

denied: requested access to the resource is denied

denied: requested access to the resource is denied 解决办法

Dockerpush denied: requested access to the resource is denied

上传docker镜像被拒绝 denied: requested access to the resource is denied

Docker和K8s实战——往docker hub推送镜像出现denied: requested access to the resource is denied

docker上传镜像错误:errors: denied: requested access to the resource is denied unauthorized: authentication