我正在跟踪此链接以使用Spring Boot项目创建Docker映像 https://dzone.com/articles/deploying-spring-boot-on-docker
已切换到Windows容器
OS:Window 10专业版
Docker版本:2.1.0.1
引擎:19.03.1
当我尝试构建图像时,出现此错误:
A:\Projects\Docker\dockerDemo>docker build -f DockerFile -t dockerdemo .
Sending build context to Docker daemon 99.84kB
Step 1/4 : FROM java:8
8: Pulling from library/java
image operating system "linux" cannot be used on this platform
DockerFile
FROM java:8
EXPOSE 8080
ADD /target/dockerdemo.jar dockerdemo.jar
ENTRYPOINT ["java", "-jar", "dockerdemo.jar"]
先谢谢了!
答案 0 :(得分:2)
您需要“ openjdk”而不是“ java”
https://hub.docker.com/_/openjdk
这将是您的Dockerfile:
FROM openjdk:[some_tag]
EXPOSE 8080
ADD /target/dockerdemo.jar dockerdemo.jar
ENTRYPOINT ["java", "-jar", "dockerdemo.jar"]
这是我在Java查询中找到的: