简体   繁体   English

Docker:java:openjdk-8-jdk-alpine图片缺少javac和tools.jar

[英]Docker: java:openjdk-8-jdk-alpine image missing javac and tools.jar

I am creating a docker image with following Dockerfile: 我正在使用以下Dockerfile创建一个docker镜像:

FROM java:openjdk-8-jdk-alpine

USER root
RUN apk update && apk add docker

COPY . /liveboard-tests
WORKDIR /liveboard-tests
ENTRYPOINT ["./gradlew", ":integration-tests:test", "--tests", "*Foo*"]

For some reason the docker container does not contain javac or tools.jar and I cannot compile java code. 由于某种原因,docker容器不包含javac或tools.jar,我无法编译java代码。 I have tried various other base images and they all have the same problem. 我尝试了各种其他基本图像,它们都有同样的问题。

Can anyone suggest a bullet proof minimal Docker file that will give me a container with ability to use javac and have tools.jar please. 任何人都可以建议一个防弹最小的Docker文件,它将给我一个能够使用javac并拥有tools.jar的容器。 TIA. TIA。

Since you are using Gradle you would be on a better position if you use FROM gradle:XYZ-jdk8-branch – replace XYZ with your project's Gradle version and branch with alpine , slim , etc.; 由于你正在使用Gradle,如果你使用FROM gradle:XYZ-jdk8-branch你会处于更好的位置FROM gradle:XYZ-jdk8-branch - 将XYZ替换为项目的Gradle版本,并使用alpineslimbranch ; have a look here for the available tags and/or releases. 看看这里有可用的标签和/或版本。

And I know this is off topic, again, but using "Docker inside Docker" doesn't work quite well and will give you some surprises down the line. 而且我知道这不再是主题了,但是使用“Docker里面的Docker”并不能很好地工作,并且会给你带来一些惊喜。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM