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

Farrukh Najmi :

I am creating a docker image with following Dockerfile:

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. 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. TIA.

x80486 :

Since you are using Gradle you would be on a better position if you use FROM gradle:X.Y.Z-jdk8-branch – replace X.Y.Z with your project's Gradle version and branch with alpine, slim, etc.; 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.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=101659&siteId=1