Cannot to apt-get install package

I want to build new datascience-notebook with some packages on the notebook. For example, I want to install java jre. But I got error: E: Unable to locate package default-jre
The full output with error is:

xiao@hp440:~/podman-test$ podman build -t notebook-packages:2025-05-30 --format=docker -f Dockerfile .
STEP 1/7: FROM quay.io/jupyter/datascience-notebook:ubuntu-22.04
STEP 2/7: SHELL ["/bin/bash", "-o", "pipefail", "-c"]
--> fcd3849fa29
STEP 3/7: USER root
--> 01e036fe1a7
STEP 4/7: WORKDIR /usr/local/software
--> ba09a4c1f9d
STEP 5/7: ADD ./java.sh /etc/profile.d/
--> 648a17a260a
STEP 6/7: RUN apt-get install build-essential
Reading package lists...
Building dependency tree...
Reading state information...
build-essential is already the newest version (12.9ubuntu3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
--> 155acd61c5e
STEP 7/7: RUN apt-get install default-jre
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package default-jre
Error: error building at STEP "RUN apt-get install default-jre": error while running runtime: exit status 100

The Dockfile file is:

FROM quay.io/jupyter/datascience-notebook:ubuntu-22.04
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
USER root
WORKDIR /usr/local/software
ADD ./java.sh /etc/profile.d/
RUN apt-get install build-essential
RUN apt-get install default-jre

Any idea? I am quite new to the docker and Jupyter. Thanks for your help.

Apt doesn’t automatically update the package repository metadata, you need to force an update by running apt-get update.
https://askubuntu.com/questions/222348/what-does-sudo-apt-get-update-do

You may also need to invalidate the Docker build cache

1 Like