1

I find that following Dockerfile builds fine (on Ubuntu 22.10), finding all the right packages:

FROM node:18.15.0

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
 && apt-get install -y --no-install-recommends \
       build-essential \
       chromium \
       chromium-sandbox \
 && apt-get clean \
 && rm -rf /var/lib/apt/lists/*

Obviously this is just an extract from the Dockerfile, there is more besides the above.

But when my Dockerfile is based on the following:

FROM ubuntu:22.10

... the same apt-get install step as above causes the build to fail, with the following error:

Package chromium 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
However the following packages replace it:
  chromium-bsu
E: Package 'chromium' has no installation candidate
E: Unable to locate package chromium-sandbox

I am slightly confused about what packages are available for each case, and why. My guess is that the one based on node:18.15.0 is ultimately based on debian-11, which is what Ubuntu 20.10 is based on. And hence why the available chromium packages are different?

I'm really confused because there is apparently no chromium package available for Ubuntu at all, only chromium-browser... see here.

So is the node:18.15.0 build getting the package from here, where chromium is indeed available?

But according to that package listing, chromium is available for bookworm (used by Ubuntu 22.10) and bullseye (used by Ubuntu 20.10), so why can't I install chromium for my ubuntu:22.10 build?

Perhaps because the bookworm package is denoted as (testing) rather than (stable)?

If so, how can I use the bookworm (testing) package in my ubuntu:22.10 build?

Sorry if any of this sounds dumb, but it's really confusing for me and I'd like to understand the mechanics of it all, thanks.

drmrbrewer
  • 11,491
  • 21
  • 85
  • 181

2 Answers2

2

While Ubuntu is being debian based, it doesn't use the exact same packages from the exact same repositories for all use cases. In this case there is a naming discrepancy between the debian and the Ubuntu packages: on debian the package is called chromium which is why everything works as expected on the debian based node image, but on Ubuntu the package is called chromium browser, hence if you try to install chromium here, it's not available.

You can find this out via the package search for debian and ubuntu

Rick Rackow
  • 1,490
  • 8
  • 19
  • I guess that partly what is confusing me is that all of these are ultimately being installed on Ubuntu, because that's my server is running, and that is what docker is running on. Are all packages in the `FROM node:18.15.0` Dockerfile going to be debian packages (with debian package names), rather than Ubuntu packages (with ubuntu package names), even though it's ultimately being installed on Ubuntu? – drmrbrewer Apr 21 '23 at 14:49
  • 2
    Ah ok, the host operating system doesn't matter for inside the container in that regard. Every image is based on something, some are from `scratch` which is really bare but a lot, like also this node image, are based on distro images. You can find out by going inside a container and then treat it like a separate box using `uname -a` or `cat /etc/debian_release` or you look up the build pipeline. For node you can also use specific tags to have it based off the distro you need, eg `node:18.15.0-buster` to have debian buster as the base image – Rick Rackow Apr 21 '23 at 15:02
  • OK that's helpful. The lightbulb is just starting to flicker on. So if your image is based on `node:18.15.0`, which shows as `Debian GNU/Linux 11 (bullseye)` inside the resulting container, then all packages are from `packages.debian.org` (or some mirror of that). And when based on `ubuntu:22.10` then all packages come from `packages.ubuntu.com`? There no possibility of using a `debian` package when your image is based on `ubuntu`? What happens if your image starts with `FROM scratch`... or maybe that's another topic entirely? – drmrbrewer Apr 21 '23 at 15:52
  • 1
    So far correct. From scratch is a bit of a different issue. You basically start from nothing. Think of it as if you were building your own distro. Generally some packages are interchangeable between debian and ubuntu but it's usually a bit of work plus you'd have to add the source repos manually. – Rick Rackow Apr 21 '23 at 16:15
0

Just to add to the answer from @RickRacklow, and to bring out some of the info in the comments, it seems that if your image is based on node:18.15.0, which shows as Debian GNU/Linux 11 (bullseye) inside the resulting container, then all packages are from packages.debian.org (or some mirror of that). And when based on ubuntu:22.10 then all packages come from packages.ubuntu.com (or some mirror of that).

Hence why you might need to use a different package name in a Dockerfile based on node:18.15.0 vs one based on ubuntu:22.10, should there be a discrepancy in the naming used in these two repositories.

UPDATE: as an aside, even trying to install and then run chromium-browser on Ubuntu complains that Command '/usr/bin/chromium-browser' requires the chromium snap to be installed. I did try, but have discovered that snap is horrible, and particularly so when trying to install this inside a Docker container. Fortunately, with a bit of work it's possible to install the Debian chromium binary even on Ubuntu, as described here. Please... no more snap installations... ridiculous!

drmrbrewer
  • 11,491
  • 21
  • 85
  • 181