我必须创建一个docker映像,从一个基本发行版的基本映像开始,并添加一些自定义文件。我在Spring Boot项目中将JIB与maven一起使用。 我正在使用Docker工具箱在Windows 7上工作。 这是我目前要执行的步骤:
1)使用以下条目创建 Dockerfile :
FROM gcr.io/distroless/java:8
COPY known_hosts ~/.ssh/known_hosts
EXPOSE 8888
2)执行命令:
docker build -t conf_server_image .
3)在pom.xml上添加了以下几行:
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>2.1.0</version>
<configuration>
<from>
<image>conf_server_image:latest</image>
</from>
<to>
<image>${project.artifactId}:${project.version}</image>
</to>
<container>
<jvmflags>
<jvmflag>-Xms512m</jvmflag>
<jvmflag>-Xmx512m</jvmflag>
</jvmflags>
</container>
</configuration>
</plugin>
4)执行命令(带有我的docker.io的ID pwd):
docker login
4)执行构建命令
mvnw clean compile jib:dockerBuild
但是该过程返回此错误:
[INFO] Executing tasks:
[INFO] [============ ] 40,0% complete
[INFO] > building image to Docker daemon
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.941 s
[INFO] Finished at: 2020-04-10T11:26:59+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:2.1.0:dockerBuild (default-cli) on project sirio-configuration-server: Build to Docker daemon failed,pe
haps you should make sure your credentials for 'registry-1.docker.io/library/conf_server_image' are set up correctly. See https://github.com/GoogleContainerTools/jib/blob/mast
r/docs/faq.md#what-should-i-do-when-the-registry-responds-with-unauthorized for help: Unauthorized for registry-1.docker.io/library/conf_server_image: 401 Unauthorized
[ERROR] {"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"repository","Class":"","Name":"library/conf_server_image","action":"pull"}]}]}
[ERROR] -> [Help 1]
[ERROR]
我忘记了什么? 谢谢