I am trying to create a docker image which includes an installed Firefox browser, using openjdk:11-slim or openjdk:11 as my base image.
This is a minimal reproducible example of my dockerfile:
FROM openjdk:11
RUN rm -rf /var/lib/apt/lists/* && \
apt-get update && apt-get install -y --no-install-recommends firefox
Here is the output of running docker build .:
$ docker build -t testing/simpleopenjdkfirefox .
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM openjdk:11
---> 1eec9f9fe101
Step 2/2 : RUN rm -rf /var/lib/apt/lists/* && apt-get update && apt-get install -y --no-install-recommends firefox
---> Running in da4e93ffe4a1
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [121 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [268 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7907 kB]
Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [7860 B]
Fetched 8422 kB in 2s (4114 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Package firefox 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 'firefox' has no installation candidate
The command '/bin/sh -c rm -rf /var/lib/apt/lists/* && apt-get update && apt-get install -y --no-install-recommends firefox' returned a non-zero code: 100
My reasons to believe that running apt-get install firefox should be possible are:
- Firefox is visible as a package on both the Debian Packages (https://packages.debian.org/search?keywords=firefox) and the Ubuntu Packages (https://packages.ubuntu.com/search?keywords=firefox&searchon=names&suite=groovy§ion=all)
apt install firefoxworks on an Ubuntu machine (just CLI, no docker involved)- In the dockerfile, replacing
firefoxwithwgetworks. This means thatapt-getis working as intended, and something is specifically incompatible withfirefox.
I've tried using the following base images:
openjdk:11-slim- my desired base image for what I'm working onopenjdk:11- the full de facto openjdk image, should be the default working caseopenjdk:11-buster- to see if Debian 10 would work
Why does the apt-get install fail in the docker build, but not in the Ubuntu CLI? Is the issue Linux OS compatibility or something else?