Search code examples
pythondockerubuntuapt

Inconsistant Docker Images


I have been using the python3.9-slim docker image, and as one of the build steps I install the 3.9 python headers, via RUN apt-get install python3-dev.

This worked for years, and then apt has changed so that python3-dev now installs the headers for Python 3.11 instead of 3.9.

On top of that, apt install python3.9-dev is not available.

I kind of didn't expect these things to be changing under the hood, and thought of using docker images as a way of getting reproducible builds.

Would anyone be able to explain how/why that has changed, and how I might better handle this in the future?

Thanks


Solution

  • The problem is that python3.9 and python3.9-slim are based on debian bookworm and this distro doesn't have this package (you can check the packages on bookworm all packages).

    If you want to have the python3.9-dev package, you can use python:3.9-slim-bullseye or python:3.9-bullseye that is based on debian bullseye (you can check the packages on this distro on bullseye all packages)