老师, 我有一个多模块的项目。我做了如下操作
1. 我在项目的最上层(顶层pom)目录执行了
mvn clean package -Dmaven.test.skip=true
显示所有模块build成功了。
2. 然后进到一个可执行子项目下面,执行
docker build -t themovez/eureka .
返回如下日志
=> [internal] load build definition from Dockerfile
=> => transferring dockerfile: 156B
=> [internal] load .dockerignore
=> => transferring context: 2B
=> [internal] load metadata for docker.io/bratfred/8-alpine:latest
=> [internal] load build context
=> => transferring context: 73.44MB
=> CACHED [1/2] FROM docker.io/bratfred/8-alpine@sha256:e820bbb6174b672a8eaf3c08aea105f0e436e4f85f46d973271b0cf73084deb5
=> [2/2] ADD target/movez-registry.jar app.jar
=> exporting to image
=> => exporting layers
=> => writing image sha256:430d9757fff81fbd86f0806946d152eb7943e90fa10826c2ee960f14c66d0836
=> => naming to docker.io/themovez/eureka
3. 我接下来想用docker run
docker run -p 8761:8761 -d themovez/eureka
然后,得到了如下返回
94e0d0141c4e9d4c6a7f37a056a4e4ac2d0466acd7427a2e122cb1d841f25af3
docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "java": executable file not found in $PATH: unknown.
请问您知道问题在哪吗?我在这个子项目下面创建了Dockerfile 如下
FROM bratfred/8-alpine ADD target/movez-registry.jar app.jar EXPOSE 8761 ENTRYPOINT ["java", "-jar", "app.jar"]
另外, 我的操作系统是 Mac big sur,Java版本 1.8.0_172, Docker 版本 如下
Client:
Version: 20.10.6
Server: Docker Engine - Community
Engine:
Version: 20.10.6
containerd:
Version: 1.4.4
runc:
Version: 1.0.0-rc93
docker-init:
Version: 0.19.0
我也遇到了,你之前咋搞的?
这个版本要升级了