Docker-尝试构建映像时出现“无法在该平台上使用映像操作系统“ linux”

时间:2019-10-04 06:38:39

标签: java windows spring-boot docker

我正在跟踪此链接以使用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"]

先谢谢了!

1 个答案:

答案 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查询中找到的:

https://hub.docker.com/search/?q=java&type=image