Docker can’t install build essentials error

Hi, I’m on Linux Mint 22.3 - Cinnamon 64-bit, and I encountered an error when trying to build an elixir phoenix container


577.1 Reading package lists...
577.1 Building dependency tree...
577.1 Reading state information... 577.1 Package build-essential is not available, but is referred to by another package. 577.1 This may mean that the package is missing, has been obsoleted, or 577.1 is only available from another source 577.1 577.1 E: Package 'build-essential' has no installation candidate 577.1 E: Unable to locate package inotify-tools 577.1 E: Unable to locate package postgresql-client ------

It’s weird because when I tried installing it normally through my terminal it says that the tool was already installed

➜  ~ sudo apt-get install build-essential
[sudo] password for lotoen:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
build-essential is already the newest version (12.10ubuntu1).

and in the apt cache

build-essential: Installed: 12.10ubuntu1 Candidate: 12.10ubuntu1 Version table: *** 12.10ubuntu1 500 500 <http://archive.ubuntu.com/ubuntu> noble/main amd64 Packages 100 /var/lib/dpkg/status

Also my dockerfile up to that command is:

FROM elixir:1.18-otp-27

WORKDIR /app

ENV MIX_ENV=dev

RUN apt-get update && \
    apt-get install --yes build-essential inotify-tools postgresql-client git && \
    apt-get clean FROM elixir:1.18-otp-27

I’ve already tried

  • restarting the docker container
  • resetting the docker cache
  • restarting vscode
  • deleting the _build and deps folder
  • using the default mirrors, main mirrors, and trying switch up the mirrors in Software Sources

Any help would be appreciated !

It is unclear which commands are executed in which environment. Commands you execute on the host say nothing about the behaviour inside a container, or while building an image.

It is safe to say the commands of the Dockerfile are executed in intermediate build containers based on the elixir:1.18-otp-27 image.

The error message you get while building indicates problems while finding the packages. It is most likely cause with whatever package repositories are coming with the elixir base image, and the commands you try to run.

This is not a problem with docker itself. As such, nothing you did on your host could be part of the solution, except changes you make to the Dockerfile.

You can wait until forum users who use elixir and know the solution see your topic and respond - This might take a while or may even never happen.

Since this issue is related to how the Elixir image is build, chances to find users the use the Elixir image and know the solution are magnitudes higher in the Elixir forum: :https://elixirforum.com/

I tried the Dockerfile and worked perfectly. So maybe it is indeed something in the local network if the end of the error message is missing and other errors were shared too. Or could be a temporary repo issue. Sometimes I noticed for short period of time some repositories don’t work until updated.