Dav*_* _- 6 java maven docker jib maven-jib
我在 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>
Run Code Online (Sandbox Code Playgroud)
这是我运行的命令:
.\mvnw clean install jib:dockerBuild -Dimage=fullstack:v1
Run Code Online (Sandbox Code Playgroud)
无论我做什么,我都会遇到以下错误:
[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
Run Code Online (Sandbox Code Playgroud)
我该怎么办?我已阅读 jib github repo 上有关身份验证的文档,但我并不真正了解如何进行并感到不知所措
更新
我跑了docker login,得到:
Authenticating with existing credentials...
Login Succeeded
Run Code Online (Sandbox Code Playgroud)
但错误仍然存在(我想我可能没有包含日志记录的某些部分:
[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
Run Code Online (Sandbox Code Playgroud)
更新2
这也是为了获取用户名和密码而引用的文件日志的内容:
{
"auths": {
"https://index.docker.io/v1/": {}
},
"credsStore": "desktop"
}
Run Code Online (Sandbox Code Playgroud)
更新3
经过两天的尝试,我决定寻找其他可以完成相同工作的东西: https: //spring.io/guides/gs/spring-boot-docker/ 这样,工作就在大约 10 分钟内完成了。生活真的很疯狂
Kha*_*mon 18
只需从 docker-config 文件中删除 credsStore 属性即可。您将在您的用户主目录中找到 config.json。
路径是:$USER/.docker/config.json 并假设该文件包含以下内容,
{
"auths": {
"https://index.docker.io/v1/": {}
},
"credsStore": "desktop"
}
Run Code Online (Sandbox Code Playgroud)
现在删除该行:“credsStore”:“desktop”
因此,该文件现在将包含以下内容
{
"auths": {
"https://index.docker.io/v1/": {}
}
}
Run Code Online (Sandbox Code Playgroud)
我在 Mac 上也遇到了同样的问题。我找到了两种解决方法:
<configuration>
...
<from>
<image>aws_account_id.dkr.ecr.region.amazonaws.com/my-base-image</image>
<auth>
<username>my_username</username>
<password>my_password</password>
</auth>
</from>
<to>
<image>gcr.io/my-gcp-project/my-app</image>
<auth>
<username>${env.REGISTRY_USERNAME}</username>
<password>${env.REGISTRY_PASSWORD}</password>
</auth>
</to>
...
</configuration>
Run Code Online (Sandbox Code Playgroud)
https://github.com/GoogleContainerTools/jib/blob/master/jib-maven-plugin/README.md#auth-object
Credential Manager或查找其他凭据存储。此外。当我研究它时,我发现了更改的建议:
"credsStore": "desktop" -> "credStore": "desktop"
Run Code Online (Sandbox Code Playgroud)
但这对我不起作用。
UPD Windows 使用同样的情况Credential Manager
| 归档时间: |
|
| 查看次数: |
12528 次 |
| 最近记录: |