Build errors when trying to install openjdk-8-jre on python:3.8-slim-buster image

  debian-buster, docker, dockerfile, java, python-3.x

I have a python script that need java runtime. I am trying to build a docker image that contains contains both python 3.8 and Java 8. Here is my Dockerfile

FROM python:3.8-slim-buster

RUN apt-get update && apt-get install -y openjdk-8-jre
    
WORKDIR /
    
ADD ./requirements.txt /
ADD ./main.py /
RUN pip install -r requirements.txt

CMD [ "python", "./main.py" ]

However I get the following error when building the image

docker.errors.BuildError: The command '/bin/sh -c apt-get update && apt-get install -y openjdk-8-jre' returned a non-zero code: 100

I have tried different python base images but I get the same error. What am I doing wrong?

Source: Docker Questions

LEAVE A COMMENT