docker上传或拉取镜像时报错:unauthorized: unauthorized to access repository

docker上传或拉取镜像时报错:
ERROR: unauthorized: unauthorized to access repository: 镜像名称 action: pull
在这里插入图片描述

原因分析

指定了镜像仓库,但未做镜像仓库认证链接

解决方式

拉取或上传之前,登录镜像仓库即可

docker login 仓库名称 -u 用户名
Password:#输入密码即可

在这里插入图片描述

注意:

一、登入仓库
docker login : 登陆到一个Docker镜像仓库,如果未指定镜像仓库地址,默认为官方仓库 Docker Hub

复制代码
语法: docker login [OPTIONS] [SERVER]
docker login -u 用户名 -p 密码 仓库名称

# 登入私有仓库
[root@wangzy ~]# docker login --username=你的用户名 registry.cn-hangzhou.aliyuncs.com
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
二、退出仓库

docker logout : 登出一个Docker镜像仓库,如果未指定镜像仓库地址,默认为官方仓库 Docker Hub

复制代码
语法: docker logout [SERVER]
# 退出默认官方仓库
[root@xxx~]# docker logout 
Removing login credentials for https://index.docker.io/v1/

# 退出私有仓库
[root@xxx ~]# docker logout registry.cn-hangzhou.aliyuncs.com
Removing login credentials for registry.cn-hangzhou.aliyuncs.com
  • 7
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值