Featured image of post Docker push unauthorized

Docker push unauthorized

docker 推送大镜像异常,报告unauthorized

记录一次harbor 镜像报错失败的定位流程

问题背景:
在通过docker client 库向harbor 仓库推送一个28G 左右的镜像时,会遇到推送到100% 左右出现unauthorized: unauthorized to access repository: project_name/repo_name 的报错,导致整个job 失败,然后出现重试,导致业务层面看到push 进度从100%–> 0% 的奇怪现象

搜索与llm

  1. llm 提示要检查nginx 转发配置和认证的token 配置的有效时间;
  2. 搜索到的绝大多数解决方法都是 login 一下

这两者中:

  1. 比较符合项目上出现的情况,因为是有成功过的推送过程的,近似于超时
  2. 离得比较远了,而且确认过鉴权正常

翻找harbor issue

Can’t push large image if the process takes more then 30 min - unauthorized to access repository
harbor push 30min超时,出现unauthorized: unauthorized to access repository
这是原issue 连接 ,有相应的解决方法如下

harbor 会话有效时间
这里对应我们业务的影响其实是会话有效时间,貌似harbor 需要在一个鉴权后的会话中完成镜像的推送流程

结论

在harbor web 管理页中修改了系统配置的会话有效时间解决了这个问题

Licensed under CC BY-NC-SA 4.0
往日已经不在,未来尚未开始
使用 Hugo 构建
主题 StackJimmy 设计