6

I am trying to install the java runtime in a Debian based docker image (mcr.microsoft.com/dotnet/core/sdk:3.1-buster). According to various howtos this should be possible by running

RUN apt update
RUN apt-get install openjdk-11-jre

The latter command comes back with

E: Unable to locate package openjdk-11-jre

However according to https://packages.debian.org/buster/openjdk-11-jre the package does exist. What am I doing wrong?

1 Answer 1

18

Unsure from which image your are pulling. I used slim, Dockerfile.

from debian:buster-slim

ENV DEBIAN_FRONTEND=noninteractive

RUN mkdir -p /usr/share/man/man1 /usr/share/man/man2

RUN apt-get update && \
apt-get install -y --no-install-recommends \
        openjdk-11-jre

# Prints installed java version, just for checking
RUN java --version

NOTE: If you don't run the mkdir -p /usr/share/man/man1 /usr/share/man/man2 you'll run into dependency problems with ca-certificates, openjdk-11-jre-headless etc. I've been using this fix provided by community, haven't really checked the permanent fix.

2
  • Turns out this was a network related issue, it is working now. Thanks anyway.
    – StefanFFM
    May 15, 2020 at 11:43
  • You NOTE saved my day. Thx
    – Sinai
    Nov 16, 2021 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.