The push refers to repository-denied: requested access to the resource is denied

情况:

在使用docker企业级私有仓库时,推送镜像到仓库出现如下报错

[root@docker01 docker]# docker push 10.0.0.12/library/alpine:latest 
The push refers to repository [10.0.0.12/library/alpine]
1bfeebd65323: Preparing 
denied: requested access to the resource is denied

原因:

在推送镜像到harbor仓库时,需要先登录

 

方法:

#登录指定harbor仓库地址
[root@docker01 docker]# docker login 10.0.0.12
Username: admin
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

PS:如果harbor仓库密码忘记可以打开找到密码文件中"YWRtaW46MTIzNDU2"使用base 64位解密
#密码文件存在/root/.docker/config.json.

[root@docker01 .docker]# cat /root/.docker/config.json 
{
	"auths": {
		"10.0.0.12": {
			"auth": "YWRtaW46MTIzNDU2"
		}
	},
	"HttpHeaders": {
		"User-Agent": "Docker-Client/19.03.6 (Linux)"
	}

 

结果:

#重新推送镜像到harbor仓库成功
[root@docker01 docker]# docker push 10.0.0.12/library/alpine:latest 
The push refers to repository [10.0.0.12/library/alpine]
1bfeebd65323: Pushed 
latest: digest: sha256:57334c50959f26ce1ee025d08f136c2292c128f84e7b229d1b0da5dac89e9866 size: 528
[root@docker01 docker]#
赞赏

微信赞赏支付宝赞赏

故障案例

Job for docker.service failed because the control process exited with error code.

2020-3-3 9:40:09

故障案例

Get https://10.0.0.12/v2/: dial tcp 10.0.0.12:443: connect: connection refused

2020-3-3 9:43:54

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
有新消息 消息中心
搜索