Docker can’t install build essentials error: Package build-essential is not available

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 ------


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 


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 !

In general I would strongly recommend using the official hexpm images, rather than the elixir image managed by your distro.

Here hexpm/elixir - Docker Image you can choose exactly which core distro you want, elixir version, and erlang version.

2 Likes