我在Windows上,这是插件配置:
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<container>
<ports>
<port>8080</port>
</ports>
<format>OCI</format>
</container>
</configuration>
</plugin>
下面是我运行的命令:
.\mvnw clean install jib:dockerBuild -Dimage=fullstack:v1
无论我做什么,我总是会遇到这样的错误:
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.2.1:dockerBuild (default-cli) on project SpringBootFullStack: Build
to Docker daemon failed, perhaps you should make sure your credentials for 'registry-1.docker.io/library/eclipse-temurin' are set up correc
tly. See https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#what-should-i-do-when-the-registry-responds-with-unauthorized f
or help: Unauthorized for registry-1.docker.io/library/eclipse-temurin: 401 Unauthorized
[ERROR] {"details":"incorrect username or password"}
[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
我应该怎么做呢?我已经阅读了jib github repo上的认证文档,但我真的不明白如何进行,感到不知所措
更新
我运行docker login
,得到:
Authenticating with existing credentials...
Login Succeeded
但错误仍然存在(我想我可能没有包括日志记录的某些部分:
[INFO] Using credentials from Docker config (C:\Users\david\.docker\config.json) for openjdk:17
[INFO] Executing tasks:
[INFO] [============ ] 40.0% complete
[INFO] > building image to Docker daemon
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.964 s
[INFO] Finished at: 2022-05-17T19:39:12+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.2.1:dockerBuild (default-cli) on project SpringBootFullStack: Build
to Docker daemon failed, perhaps you should make sure your credentials for 'registry-1.docker.io/library/openjdk' are set up correctly. See
Unauthorized for registry-1.docker.io/library/openjdk: 401 Unauthorized
[ERROR] {"details":"incorrect username or password"}
[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
更新2
这也是文件日志为获取用户名和密码而参考的内容:
{
"auths": {
"https://index.docker.io/v1/": {}
},
"credsStore": "desktop"
}
更新3
经过两天的尝试,我决定寻找其他能做同样工作的东西:有了这个,工作在10分钟内就完成了。生活真的很疯狂
6条答案
按热度按时间1u4esq0p1#
只需从docker-config文件中删除credsStore属性,即可在用户主目录中找到config.json。
路径为:$USER/. docker/config.json并假设该文件包含以下内容,
现在删除行:“信用存储”:“桌面”
因此,该文件现在将包含以下内容
ljsrvy3e2#
来自服务器的响应是明确的。凭据被给予服务器,它说它们是错误的。
事实上,Jib确实从Docker
config.json
文件中检索到了一些(可能是不工作的)凭证:尝试清空整个
config.json
或删除文件。特别是删除"https://index.docker.io/v1/"
和credsStore
的条目。可能是同样的问题,以这个Stack Overflow question。也看看这个GitHub issue的Jib回购。
ozxc1zmp3#
我在Mac上也遇到了同样的问题。我找到了两种解决方法:
1.为此,您可以使用吊臂配置:
https://github.com/GoogleContainerTools/jib/blob/master/jib-maven-plugin/README.md#auth-object
1.第二种方法不是关于Windows,我在Mac OS上修复了这个问题,但你可以尝试使用我的经验。我想,这是奇怪的,如果我们得到401未授权,最有可能的Jib试图登录与一些错误的凭据。在我的情况下,我发现2行钥匙链访问:
Credential Manager
或找到一些其他的凭据存储。另外,当我在研究它的时候,我发现了一些改变的建议:
但对我没用。
vxf3dgd44#
我在Windows上遇到了同样的问题。请尝试删除以下凭据:
https://i.stack.imgur.com/G9aGR.png
nkkqxpd95#
如果您不想执行额外的凭证配置步骤,请在运行
mvn package
时传递它们,如下所示:它将根据需要构建并推送到Docker Hub。
omvjsjqw6#
我在windows上遇到了这个问题,并解决了如下问题:
控制面板\所有控制面板项目\凭据管理器
从这里,我已经删除了Generic Credentials部分中与Docker相关的所有条目
powershell提示符中的:
Docker登录
而且成功了!