action: push: unauthorized to access repository: shgbitai/llm-ability, action: push“

[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.3.1:build (docker-push) on project llm-ability: Build image failed, perhaps you should make sure your credentials for 'harbor.shgbitai.com/shgbitai/llm-ability' are set up correctly. See https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#what-should-i-do-when-the-registry-responds-with-unauthorized for help: Unauthorized for harbor.shgbitai.com/shgbitai/llm-ability: 401 Unauthorized
[ERROR] POST https://harbor.shgbitai.com/v2/shgbitai/llm-ability/blobs/uploads/?mount=sha256:f2ca3cf9dc1103518bf662f29287c9c9e949b31cd9cb1aeae5dafcd4ec37b0d8&from=shgbitai/openjdk
[ERROR] {"errors":[{"code":"UNAUTHORIZED","message":"unauthorized to access repository: shgbitai/llm-ability, action: push: unauthorized to access repository: shgbitai/llm-ability, action: push"}]}
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
已与地址为 ''127.0.0.1:34309',传输: '套接字'' 的目标虚拟机断开连接

这个错误表明你在使用 jib-maven-plugin 推送 Docker 镜像到 harbor.shgbitai.com 仓库时遇到了授权问题。具体来说,错误消息 401 Unauthorized 表明你没有正确的凭据来访问或推送到该仓库。

以下是一些可能的解决方案:

  1. 检查 Docker Registry 凭据
    确保你已经正确配置了 Docker Registry 的凭据。你可以使用 docker login 命令手动登录到仓库,确保你能够访问和推送镜像。

    docker login harbor.shgbitai.com
    
  2. 配置 Jib 插件凭据
    确保在你的 pom.xml 文件中正确配置了 Jib 插件的凭据。你可以在 <configuration> 部分中添加 auth 配置。

    <plugin>
        <groupId>com.google.cloud.tools</groupId>
        <artifactId>jib-maven-plugin</artifactId>
        <version>3.3.1</version>
        <configuration>
            <to>
                <image>harbor.shgbitai.com/shgbitai/llm-ability</image>
                <auth>
                    <username>${env.HARBOR_USERNAME}</username>
                    <password>${env.HARBOR_PASSWORD}</password>
                </auth>
            </to>
        </configuration>
    </plugin>
    

    请确保你已经在环境变量中设置了 HARBOR_USERNAMEHARBOR_PASSWORD

  3. 使用 Maven 的 Settings 配置文件
    你可以在 ~/.m2/settings.xml 文件中配置仓库的凭据:

    <servers>
        <server>
            <id>harbor-shgbitai</id>
            <username>your-username</username>
            <password>your-password</password>
        </server>
    </servers>
    

    然后在你的 pom.xml 文件中引用这个服务器 ID:

    <plugin>
        <groupId>com.google.cloud.tools</groupId>
        <artifactId>jib-maven-plugin</artifactId>
        <version>3.3.1</version>
        <configuration>
            <to>
                <image>harbor.shgbitai.com/shgbitai/llm-ability</image>
                <credHelper>harbor-shgbitai</credHelper>
            </to>
        </configuration>
    </plugin>
    
  4. 确保正确的仓库路径
    确保你的仓库路径和镜像名称是正确的,并且你有权限推送到这个仓库。

  5. 网络问题
    有时候网络问题也可能导致授权失败,确保你的网络连接正常,并且没有被防火墙或代理阻挡。

如果你已经检查了以上所有步骤,问题仍然存在,请查看更详细的错误日志,使用 mvn -X 进行调试日志输出,以便进一步诊断问题。

mvn -X com.google.cloud.tools:jib-maven-plugin:3.3.1:build
  • 5
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

MonkeyKing.sun

对你有帮助的话,可以打赏

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值