StefanFFM
StefanFFM

Reputation: 1908

Install Java runtime in Debian based docker image

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?

Upvotes: 6

Views: 17254

Answers (1)

Saurabh
Saurabh

Reputation: 568

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.

Upvotes: 19

Related Questions