spring boot maven docker镜像问题

问题描述

我之前使用过 spring boot 插件来构建图像,但是我看到了奇怪的行为。基本上这个过程已经停滞。它已经持续了一个多小时,我不知道为什么。

我跑了:mvn spring-boot:build-image -Dspring-boot.build-image.imageName=bootiful/demo

这是没有进一步进展的输出

[INFO] --- spring-boot-maven-plugin:2.4.1:build-image (default-cli) @ liquidity-system ---
[INFO] Building image 'docker.io/bootiful/demo:latest'
[INFO]
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 100%
[INFO]  > Pulled builder image 'paketobuildpacks/builder@sha256:4b91576bbf90ee67ccb6a178a345bc5266e4f9eac62d8df580d66ea70ff54e47'
[INFO]  > Pulling run image 'docker.io/paketobuildpacks/run:base-cnb' 100%
[INFO]  > Pulled run image 'paketobuildpacks/run@sha256:7c0092c534e1646fc80d1578fb9cf0ab925af2ad95a7469edf681539cba44c56'
[INFO]  > Executing lifecycle version v0.10.1
[INFO]  > Using build cache volume 'pack-cache-cc2912ef7439.build'
[INFO]
[INFO]  > Running creator

我的互联网连接已接通。环境是:

  • Macos 11.1

  • Java 14

  • Maven 3.6.3

  • docker 桌面 3.0.3

  • spring boot 2.4.1

  • 编辑:添加详细输出

[INFO] --- spring-boot-maven-plugin:2.4.1:build-image (default-cli) @ liquidity-system ---
[DEBUG] Configuring mojo org.springframework.boot:spring-boot-maven-plugin:2.4.1:build-image from plugin realm ClassRealm[plugin>org.springframework.boot:spring-boot-maven-plugin:2.4.1,parent: jdk.internal.loader.ClassLoaders$AppClassLoader@55054057]
[DEBUG] Configuring mojo 'org.springframework.boot:spring-boot-maven-plugin:2.4.1:build-image' with basic configurator -->
[DEBUG]   (f) classifier = exec
[DEBUG]   (f) excludeDevtools = true
[DEBUG]   (f) excludes = []
[DEBUG]   (f) finalName = liquidity-system-2.1-SNAPSHOT
[DEBUG]   (f) imageName = bootiful/demo
[DEBUG]   (f) includeSystemScope = false
[DEBUG]   (f) includes = []
[DEBUG]   (f) mainClass = com.liquidity.LiquidityApplication
[DEBUG]   (f) project = MavenProject: com.liquidity:liquidity-system:2.1-SNAPSHOT @ /Users/liquidity-system/pom.xml
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@1d0a61c8
[DEBUG]   (f) skip = false
[DEBUG]   (f) sourceDirectory = /Users/liquidity-system/target
[DEBUG] -- end configuration --
[INFO] Building image 'docker.io/bootiful/demo:latest'
[INFO]
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Get connection for route {}->docker://localhost:2376
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] opening connection {}->docker://localhost:2376
[DEBUG] Connecting to localhost/127.0.0.1:2376
[DEBUG] Connection established
[DEBUG] Executing request POST /v1.24/images/create?fromImage=docker.io%2Fpaketobuildpacks%2Fbuilder%3Abase 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%3Abase HTTP/1.1
[DEBUG] http-outgoing-0 >> Content-Length: 0
[DEBUG] http-outgoing-0 >> Host: localhost
[DEBUG] http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/15.0.1)
[DEBUG] http-outgoing-0 >> Accept-Encoding: gzip,deflate
[DEBUG] http-outgoing-0 << HTTP/1.1 200 OK
[DEBUG] http-outgoing-0 << Api-Version: 1.41
[DEBUG] http-outgoing-0 << Content-Type: application/json
[DEBUG] http-outgoing-0 << Date: Tue,12 Jan 2021 07:14:52 GMT
[DEBUG] http-outgoing-0 << Docker-Experimental: false
[DEBUG] http-outgoing-0 << Ostype: linux
[DEBUG] http-outgoing-0 << Server: Docker/20.10.2 (linux)
[DEBUG] http-outgoing-0 << transfer-encoding: chunked
[DEBUG] Connection can be kept alive indefinitely
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 0%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 1%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 1%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 2%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 2%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 3%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 4%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 5%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 5%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 6%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 10%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 10%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 11%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 11%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 12%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 12%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 13%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 14%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 15%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 16%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 16%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 17%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 17%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 19%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 20%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 21%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 22%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 24%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 26%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 28%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 29%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 30%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 34%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 39%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 44%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 51%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 59%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 65%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 70%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 76%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 81%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 83%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 87%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 89%
[DEBUG] Releasing connection
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Get connection for route {}->docker://localhost:2376
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Executing request GET /v1.24/images/docker.io/paketobuildpacks/builder@sha256:2fbe23a13024af36db7c05b00b58361f4e4aed8eb679519daafd035f653098fb/json 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:2fbe23a13024af36db7c05b00b58361f4e4aed8eb679519daafd035f653098fb/json HTTP/1.1
[DEBUG] http-outgoing-0 >> Host: localhost
[DEBUG] http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/15.0.1)
[DEBUG] http-outgoing-0 >> Accept-Encoding: gzip,12 Jan 2021 07:16:23 GMT
[DEBUG] http-outgoing-0 << Docker-Experimental: false
[DEBUG] http-outgoing-0 << Ostype: linux
[DEBUG] http-outgoing-0 << Server: Docker/20.10.2 (linux)
[DEBUG] http-outgoing-0 << transfer-encoding: chunked
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] Releasing connection
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Connection can be kept alive indefinitely
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 100%
[INFO]  > Pulled builder image 'paketobuildpacks/builder@sha256:2fbe23a13024af36db7c05b00b58361f4e4aed8eb679519daafd035f653098fb'
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Get connection for route {}->docker://localhost:2376
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Executing request POST /v1.24/images/create?fromImage=docker.io%2Fpaketobuildpacks%2Frun%3Abase-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%3Abase-cnb HTTP/1.1
[DEBUG] http-outgoing-0 >> Content-Length: 0
[DEBUG] http-outgoing-0 >> Host: localhost
[DEBUG] http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/15.0.1)
[DEBUG] http-outgoing-0 >> Accept-Encoding: gzip,12 Jan 2021 07:16:29 GMT
[DEBUG] http-outgoing-0 << Docker-Experimental: false
[DEBUG] http-outgoing-0 << Ostype: linux
[DEBUG] http-outgoing-0 << Server: Docker/20.10.2 (linux)
[DEBUG] http-outgoing-0 << transfer-encoding: chunked
[DEBUG] Connection can be kept alive indefinitely
[INFO]  > Pulling run image 'docker.io/paketobuildpacks/run:base-cnb' 7%
[INFO]  > Pulling run image 'docker.io/paketobuildpacks/run:base-cnb' 23%
[INFO]  > Pulling run image 'docker.io/paketobuildpacks/run:base-cnb' 25%
[INFO]  > Pulling run image 'docker.io/paketobuildpacks/run:base-cnb' 31%
[DEBUG] Releasing connection
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Get connection for route {}->docker://localhost:2376
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Executing request GET /v1.24/images/docker.io/paketobuildpacks/run@sha256:0cb3de382afbd5da1e01515f55ab017011ac4d76c77fabb44006f0d0546b2722/json 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:0cb3de382afbd5da1e01515f55ab017011ac4d76c77fabb44006f0d0546b2722/json HTTP/1.1
[DEBUG] http-outgoing-0 >> Host: localhost
[DEBUG] http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/15.0.1)
[DEBUG] http-outgoing-0 >> Accept-Encoding: gzip,12 Jan 2021 07:16:38 GMT
[DEBUG] http-outgoing-0 << Docker-Experimental: false
[DEBUG] http-outgoing-0 << Ostype: linux
[DEBUG] http-outgoing-0 << Server: Docker/20.10.2 (linux)
[DEBUG] http-outgoing-0 << transfer-encoding: chunked
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] Releasing connection
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Connection can be kept alive indefinitely
[INFO]  > Pulling run image 'docker.io/paketobuildpacks/run:base-cnb' 100%
[INFO]  > Pulled run image 'paketobuildpacks/run@sha256:0cb3de382afbd5da1e01515f55ab017011ac4d76c77fabb44006f0d0546b2722'
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Get connection for route {}->docker://localhost:2376
[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: localhost
[DEBUG] http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/15.0.1)
[DEBUG] http-outgoing-0 >> Accept-Encoding: gzip,12 Jan 2021 07:16:38 GMT
[DEBUG] http-outgoing-0 << Docker-Experimental: false
[DEBUG] http-outgoing-0 << Ostype: linux
[DEBUG] http-outgoing-0 << Server: Docker/20.10.2 (linux)
[DEBUG] http-outgoing-0 << transfer-encoding: chunked
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] Releasing connection
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Connection can be kept alive indefinitely
[INFO]  > Executing lifecycle version v0.10.1
[INFO]  > Using build cache volume 'pack-cache-cc2912ef7439.build'
[INFO]
[INFO]  > Running creator
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Get connection for route {}->docker://localhost:2376
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Executing request POST /v1.24/containers/create HTTP/1.1
[DEBUG] Target auth state: UNCHALLENGED
[DEBUG] Proxy auth state: UNCHALLENGED
[DEBUG] http-outgoing-0 >> POST /v1.24/containers/create HTTP/1.1
[DEBUG] http-outgoing-0 >> Content-Length: 693
[DEBUG] http-outgoing-0 >> Content-Type: application/json
[DEBUG] http-outgoing-0 >> Host: localhost
[DEBUG] http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/15.0.1)
[DEBUG] http-outgoing-0 >> Accept-Encoding: gzip,deflate
[DEBUG] http-outgoing-0 << HTTP/1.1 201 Created
[DEBUG] http-outgoing-0 << Api-Version: 1.41
[DEBUG] http-outgoing-0 << Content-Type: application/json
[DEBUG] http-outgoing-0 << Date: Tue,12 Jan 2021 07:16:39 GMT
[DEBUG] http-outgoing-0 << Docker-Experimental: false
[DEBUG] http-outgoing-0 << Ostype: linux
[DEBUG] http-outgoing-0 << Server: Docker/20.10.2 (linux)
[DEBUG] http-outgoing-0 << transfer-encoding: chunked
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] Releasing connection
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Get connection for route {}->docker://localhost:2376
[DEBUG] http-outgoing-0: set socket timeout to 0
[DEBUG] Executing request PUT /v1.24/containers/7b5260745e434e201a1a29e29dd0b396e8862a858e18d669d92b08f0fa0e4e6b/archive?path=%2Fworkspace HTTP/1.1
[DEBUG] Target auth state: UNCHALLENGED
[DEBUG] Proxy auth state: UNCHALLENGED
[DEBUG] http-outgoing-0 >> PUT /v1.24/containers/7b5260745e434e201a1a29e29dd0b396e8862a858e18d669d92b08f0fa0e4e6b/archive?path=%2Fworkspace HTTP/1.1
[DEBUG] http-outgoing-0 >> transfer-encoding: chunked
[DEBUG] http-outgoing-0 >> Content-Type: application/x-tar
[DEBUG] http-outgoing-0 >> Host: localhost
[DEBUG] http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/15.0.1)
[DEBUG] http-outgoing-0 >> Accept-Encoding: gzip,deflate
[DEBUG] http-outgoing-0: Close connection
[DEBUG] http-outgoing-0: Shutdown connection
[DEBUG] Connection discarded
[DEBUG] Releasing connection [Not bound]
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Get connection for route {}->docker://localhost:2376
[DEBUG] http-outgoing-1: set socket timeout to 0
[DEBUG] opening connection {}->docker://localhost:2376
[DEBUG] Connecting to localhost/127.0.0.1:2376
[DEBUG] Connection established
[DEBUG] Executing request DELETE /v1.24/volumes/pack-layers-dydykjjknl?force=1 HTTP/1.1
[DEBUG] Target auth state: UNCHALLENGED
[DEBUG] Proxy auth state: UNCHALLENGED
[DEBUG] http-outgoing-1 >> DELETE /v1.24/volumes/pack-layers-dydykjjknl?force=1 HTTP/1.1
[DEBUG] http-outgoing-1 >> Host: localhost
[DEBUG] http-outgoing-1 >> Connection: Keep-Alive
[DEBUG] http-outgoing-1 >> User-Agent: Apache-HttpClient/4.5.13 (Java/15.0.1)
[DEBUG] http-outgoing-1 >> Accept-Encoding: gzip,deflate
[DEBUG] http-outgoing-1 << HTTP/1.1 409 Conflict
[DEBUG] http-outgoing-1 << Api-Version: 1.41
[DEBUG] http-outgoing-1 << Content-Type: application/json
[DEBUG] http-outgoing-1 << Date: Tue,12 Jan 2021 07:16:39 GMT
[DEBUG] http-outgoing-1 << Docker-Experimental: false
[DEBUG] http-outgoing-1 << Ostype: linux
[DEBUG] http-outgoing-1 << Server: Docker/20.10.2 (linux)
[DEBUG] http-outgoing-1 << transfer-encoding: chunked
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] Releasing connection
[DEBUG] http-outgoing-1: set socket timeout to 0
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] CookieSpec selected: default
[DEBUG] Auth cache not set in the context
[DEBUG] Get connection for route {}->docker://localhost:2376
[DEBUG] http-outgoing-1: set socket timeout to 0
[DEBUG] Executing request DELETE /v1.24/images/pack.local/builder/bngnnuyzva:latest?force=1 HTTP/1.1
[DEBUG] Target auth state: UNCHALLENGED
[DEBUG] Proxy auth state: UNCHALLENGED
[DEBUG] http-outgoing-1 >> DELETE /v1.24/images/pack.local/builder/bngnnuyzva:latest?force=1 HTTP/1.1
[DEBUG] http-outgoing-1 >> Host: localhost
[DEBUG] http-outgoing-1 >> Connection: Keep-Alive
[DEBUG] http-outgoing-1 >> User-Agent: Apache-HttpClient/4.5.13 (Java/15.0.1)
[DEBUG] http-outgoing-1 >> Accept-Encoding: gzip,deflate

解决方法

问题原来是在定义spring boot maven插件的另一个区域设置了<classifier>。删除 classifier 解决了问题