如何解决我在 win10 上无法使用 `mvn spring-boot:build-image` 和远程 docker 守护进程
spring-boot-starter-parentm 2.4.4
我的项目在 win 上,docker 在另一个 linux 上。即使我把构建好的jar放到linux上对应的目录(/home/iserver/spring)也不能成功
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>2020.0.2</spring-cloud.version>
<spring-native.version>0.9.1</spring-native.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.experimental</groupId>
<artifactId>spring-native</artifactId>
<version>${spring-native.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<builder>paketobuildpacks/builder:tiny</builder>
<env>
<BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
</env>
</image>
<docker>
<host>tcp://{remoteDockerIp}:2375</host>
</docker>
<sourceDirectory>/home/iserver/spring</sourceDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.experimental</groupId>
<artifactId>spring-aot-maven-plugin</artifactId>
<version>${spring-native.version}</version>
<executions>
<execution>
<id>test-generate</id>
<goals>
<goal>test-generate</goal>
</goals>
</execution>
<execution>
<id>generate</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
</pluginRepository>
</pluginRepositories>
</project>
虽然mvn spring-boot:build-image
Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.4.4:build-image (default-cli) on project demo: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:2.4.4:build-image Failed: Executable jar file required for building image
日志
[INFO]
[INFO] --- spring-boot-maven-plugin:2.4.4:build-image (default-cli) @ demo ---
[DEBUG] Configuring mojo org.springframework.boot:spring-boot-maven-plugin:2.4.4:build-image from plugin realm ClassRealm[plugin>org.springframework.boot:spring-boot-maven-plugin:2.4.4,parent: sun.misc.Launcher$AppClassLoader@18b4aac2]
[DEBUG] Configuring mojo 'org.springframework.boot:spring-boot-maven-plugin:2.4.4:build-image' with basic configurator -->
[DEBUG] (f) host = tcp://192.168.13.178:2375
[DEBUG] (f) docker = org.springframework.boot.maven.Docker@3a2b1f24
[DEBUG] (f) excludeDevtools = true
[DEBUG] (f) excludes = []
[DEBUG] (f) finalName = demo-0.0.1-SNAPSHOT
[DEBUG] (f) builder = paketobuildpacks/builder:tiny
[DEBUG] (f) env = {BP_NATIVE_IMAGE=true}
[DEBUG] (f) image = org.springframework.boot.maven.Image@1314ccc1
[DEBUG] (f) includeSystemScope = false
[DEBUG] (f) includes = []
[DEBUG] (f) project = MavenProject: com.example:demo:0.0.1-SNAPSHOT @ E:\WorkSpace\code\java\spring\demo\pom.xml
[DEBUG] (f) session = org.apache.maven.execution.MavenSession@350b3a17
[DEBUG] (f) skip = false
[DEBUG] (f) sourceDirectory = E:\home\iserver\spring
[DEBUG] -- end configuration --
[INFO] Building image 'docker.io/library/demo:0.0.1-SNAPSHOT'
[INFO]
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Connection request: [route: {}->http://192.168.13.178:2375][total available: 0; route allocated: 0 of 2; total allocated: 0 of 20]
[DEBUG] Connection leased: [id: 0][route: {}->http://192.168.13.178:2375][total available: 0; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] opening connection {}->http://192.168.13.178:2375
[DEBUG] Connecting to /192.168.13.178:2375
[DEBUG] Connection established 192.168.13.232:10118<->192.168.13.178:2375
[DEBUG] Executing request POST /v1.24/images/create?fromImage=docker.io%2Fpaketobuildpacks%2Fbuilder%3Atiny HTTP/1.1
[DEBUG] Target auth state: UNCHALLENGED
[DEBUG] Proxy auth state: UNCHALLENGED
[DEBUG] http-outgoing-0 >> POST /v1.24/images/create?fromImage=docker.io%2Fpaketobuildpacks%2Fbuilder%3Atiny HTTP/1.1
[DEBUG] http-outgoing-0 >> Content-Length: 0
[DEBUG] http-outgoing-0 >> Host: 192.168.13.178:2375
[DEBUG] http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_282)
[DEBUG] http-outgoing-0 >> Accept-Encoding: gzip,deflate
[DEBUG] http-outgoing-0 << HTTP/1.1 200 OK
[DEBUG] http-outgoing-0 << Api-Version: 1.40
[DEBUG] http-outgoing-0 << Content-Type: application/{remoteDockerIp}
[DEBUG] http-outgoing-0 << Docker-Experimental: false
[DEBUG] http-outgoing-0 << Ostype: linux
[DEBUG] http-outgoing-0 << Server: Docker/19.03.5 (linux)
[DEBUG] http-outgoing-0 << Date: Thu,01 Apr 2021 01:34:28 GMT
[DEBUG] http-outgoing-0 << transfer-encoding: chunked
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] Connection [id: 0][route: {}->http://192.168.13.178:2375] can be kept alive indefinitely
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Connection released: [id: 0][route: {}->http://192.168.13.178:2375][total available: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Connection request: [route: {}->http://192.168.13.178:2375][total available: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] Connection leased: [id: 0][route: {}->http://192.168.13.178:2375][total available: 0; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Executing request GET /v1.24/images/docker.io/paketobuildpacks/builder@sha256:3b2a9a7ace49a36b2762b5f2d3a7524f8b58cc41854e47f1e3cec448eba8319c/{remoteDockerIp} HTTP/1.1
[DEBUG] Target auth state: UNCHALLENGED
[DEBUG] Proxy auth state: UNCHALLENGED
[DEBUG] http-outgoing-0 >> GET /v1.24/images/docker.io/paketobuildpacks/builder@sha256:3b2a9a7ace49a36b2762b5f2d3a7524f8b58cc41854e47f1e3cec448eba8319c/{remoteDockerIp} HTTP/1.1
[DEBUG] http-outgoing-0 >> Host: 192.168.13.178:2375
[DEBUG] http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_282)
[DEBUG] http-outgoing-0 >> Accept-Encoding: gzip,01 Apr 2021 01:34:28 GMT
[DEBUG] http-outgoing-0 << transfer-encoding: chunked
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] Connection [id: 0][route: {}->http://192.168.13.178:2375] can be kept alive indefinitely
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Connection released: [id: 0][route: {}->http://192.168.13.178:2375][total available: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[INFO] > Pulling builder image 'docker.io/paketobuildpacks/builder:tiny' 100%
[INFO] > Pulled builder image 'paketobuildpacks/builder@sha256:3b2a9a7ace49a36b2762b5f2d3a7524f8b58cc41854e47f1e3cec448eba8319c'
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Connection request: [route: {}->http://192.168.13.178:2375][total available: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] Connection leased: [id: 0][route: {}->http://192.168.13.178:2375][total available: 0; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Executing request POST /v1.24/images/create?fromImage=docker.io%2Fpaketobuildpacks%2Frun%3Atiny-cnb HTTP/1.1
[DEBUG] Target auth state: UNCHALLENGED
[DEBUG] Proxy auth state: UNCHALLENGED
[DEBUG] http-outgoing-0 >> POST /v1.24/images/create?fromImage=docker.io%2Fpaketobuildpacks%2Frun%3Atiny-cnb HTTP/1.1
[DEBUG] http-outgoing-0 >> Content-Length: 0
[DEBUG] http-outgoing-0 >> Host: 192.168.13.178:2375
[DEBUG] http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_282)
[DEBUG] http-outgoing-0 >> Accept-Encoding: gzip,01 Apr 2021 01:34:44 GMT
[DEBUG] http-outgoing-0 << transfer-encoding: chunked
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] Connection [id: 0][route: {}->http://192.168.13.178:2375] can be kept alive indefinitely
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Connection released: [id: 0][route: {}->http://192.168.13.178:2375][total available: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Connection request: [route: {}->http://192.168.13.178:2375][total available: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] Connection leased: [id: 0][route: {}->http://192.168.13.178:2375][total available: 0; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Executing request GET /v1.24/images/docker.io/paketobuildpacks/run@sha256:d4923f52c0db29257e19708d557051a5be4385e8128ce2431665d75ae84b8a1a/{remoteDockerIp} HTTP/1.1
[DEBUG] Target auth state: UNCHALLENGED
[DEBUG] Proxy auth state: UNCHALLENGED
[DEBUG] http-outgoing-0 >> GET /v1.24/images/docker.io/paketobuildpacks/run@sha256:d4923f52c0db29257e19708d557051a5be4385e8128ce2431665d75ae84b8a1a/{remoteDockerIp} HTTP/1.1
[DEBUG] http-outgoing-0 >> Host: 192.168.13.178:2375
[DEBUG] http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_282)
[DEBUG] http-outgoing-0 >> Accept-Encoding: gzip,01 Apr 2021 01:34:44 GMT
[DEBUG] http-outgoing-0 << transfer-encoding: chunked
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] Connection [id: 0][route: {}->http://192.168.13.178:2375] can be kept alive indefinitely
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Connection released: [id: 0][route: {}->http://192.168.13.178:2375][total available: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[INFO] > Pulling run image 'docker.io/paketobuildpacks/run:tiny-cnb' 100%
[INFO] > Pulled run image 'paketobuildpacks/run@sha256:d4923f52c0db29257e19708d557051a5be4385e8128ce2431665d75ae84b8a1a'
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Connection request: [route: {}->http://192.168.13.178:2375][total available: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] Connection leased: [id: 0][route: {}->http://192.168.13.178:2375][total available: 0; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Executing request POST /v1.24/images/load HTTP/1.1
[DEBUG] Target auth state: UNCHALLENGED
[DEBUG] Proxy auth state: UNCHALLENGED
[DEBUG] http-outgoing-0 >> POST /v1.24/images/load HTTP/1.1
[DEBUG] http-outgoing-0 >> transfer-encoding: chunked
[DEBUG] http-outgoing-0 >> Content-Type: application/x-tar
[DEBUG] http-outgoing-0 >> Host: 192.168.13.178:2375
[DEBUG] http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_282)
[DEBUG] http-outgoing-0 >> Accept-Encoding: gzip,01 Apr 2021 01:34:44 GMT
[DEBUG] http-outgoing-0 << transfer-encoding: chunked
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] Connection [id: 0][route: {}->http://192.168.13.178:2375] can be kept alive indefinitely
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Connection released: [id: 0][route: {}->http://192.168.13.178:2375][total available: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[INFO] > Executing lifecycle version v0.10.1
[INFO] > Using build cache volume 'pack-cache-5cbe5692dbc4.build'
[INFO]
[INFO] > Running creator
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Connection request: [route: {}->http://192.168.13.178:2375][total available: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] Connection leased: [id: 0][route: {}->http://192.168.13.178:2375][total available: 0; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Executing request DELETE /v1.24/volumes/pack-layers-pmwnnbewwy?force=1 HTTP/1.1
[DEBUG] Target auth state: UNCHALLENGED
[DEBUG] Proxy auth state: UNCHALLENGED
[DEBUG] http-outgoing-0 >> DELETE /v1.24/volumes/pack-layers-pmwnnbewwy?force=1 HTTP/1.1
[DEBUG] http-outgoing-0 >> Host: 192.168.13.178:2375
[DEBUG] http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_282)
[DEBUG] http-outgoing-0 >> Accept-Encoding: gzip,deflate
[DEBUG] http-outgoing-0 << HTTP/1.1 204 No Content
[DEBUG] http-outgoing-0 << Api-Version: 1.40
[DEBUG] http-outgoing-0 << Docker-Experimental: false
[DEBUG] http-outgoing-0 << Ostype: linux
[DEBUG] http-outgoing-0 << Server: Docker/19.03.5 (linux)
[DEBUG] http-outgoing-0 << Date: Thu,01 Apr 2021 01:34:44 GMT
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] Connection [id: 0][route: {}->http://192.168.13.178:2375] can be kept alive indefinitely
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Connection released: [id: 0][route: {}->http://192.168.13.178:2375][total available: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Connection request: [route: {}->http://192.168.13.178:2375][total available: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] Connection leased: [id: 0][route: {}->http://192.168.13.178:2375][total available: 0; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Executing request DELETE /v1.24/volumes/pack-app-ntswwmmvkx?force=1 HTTP/1.1
[DEBUG] Target auth state: UNCHALLENGED
[DEBUG] Proxy auth state: UNCHALLENGED
[DEBUG] http-outgoing-0 >> DELETE /v1.24/volumes/pack-app-ntswwmmvkx?force=1 HTTP/1.1
[DEBUG] http-outgoing-0 >> Host: 192.168.13.178:2375
[DEBUG] http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_282)
[DEBUG] http-outgoing-0 >> Accept-Encoding: gzip,01 Apr 2021 01:34:44 GMT
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] Connection [id: 0][route: {}->http://192.168.13.178:2375] can be kept alive indefinitely
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Connection released: [id: 0][route: {}->http://192.168.13.178:2375][total available: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Connection request: [route: {}->http://192.168.13.178:2375][total available: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] Connection leased: [id: 0][route: {}->http://192.168.13.178:2375][total available: 0; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Executing request DELETE /v1.24/images/pack.local/builder/gpkywzhokr:latest?force=1 HTTP/1.1
[DEBUG] Target auth state: UNCHALLENGED
[DEBUG] Proxy auth state: UNCHALLENGED
[DEBUG] http-outgoing-0 >> DELETE /v1.24/images/pack.local/builder/gpkywzhokr:latest?force=1 HTTP/1.1
[DEBUG] http-outgoing-0 >> Host: 192.168.13.178:2375
[DEBUG] http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_282)
[DEBUG] http-outgoing-0 >> Accept-Encoding: gzip,01 Apr 2021 01:34:44 GMT
[DEBUG] http-outgoing-0 << Content-Length: 226
[DEBUG] Connection can be kept alive indefinitely
==================
如果我不设置/home/iserver/spring
Failed to execute target org.springframework.boot:spring-boot-maven-plugin:2.4.4:build-image (default-cli) on project demo: Execution default-cli of target org.springframework.boot:spring -boot-maven-plugin:2.4.4:build-image Failed: Builder 生命周期“creator”失败,状态码为 100
解决方法
问题出在小型建造者身上
<builder>paketobuildpacks/builder:tiny</builder>
如果我使用 paketobuildpacks/builder:base
,没关系
可以使用`paketobuildpacks/builder:0.1.58-tiny
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。