Docker Community Forums

Share and learn in the Docker community.

Dockerfile, Package openjdk-8-jre-headless is not available / Package has no installation candidate

I’m trying to install openjdk-8-jre vie custom DockerFile for nginx, as I build the docker images for my composer. But I’m hitting this error message.

Error message:

Package openjdk-8-jre-headless is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'openjdk-8-jre-headless' has no installation candidate

Here is the part from Dockerfile:

# Install openjdk and java cacerts
RUN apt-get update && apt-get install -y openjdk-8-jre-headless ca-certificates-java

If I install java directly from the console, by using exact same command without RUN, no problem with the package. But as I try installing it from the Dockerfile, I hit the error. I have understood that Docker uses same repos as the machine where docker is running? Ubuntu is version 16.04.