pythondockerdockerfiledebiandebian-bookworm

debian:12-slim breaking apt update for mysql


In switching from python:3.8.16-slim (which is based on debian:11-slim) to python:3.8.18-slim (which is based on debian:12-slim), the following Dockerfile now fails to build with the following error. The change in python version is the only difference.

FROM python:3.8.18-slim

RUN pip install awscli==1.19.29

# wget, lsb-release, gnupg required by mysql-apt-config
RUN apt-get update && apt-get install -y --no-install-recommends \
      wget \
      lsb-release \
      gnupg \
    && rm -rf /var/lib/apt/lists/*

# if public key for mysql client is expired, check https://dev.mysql.com/downloads/repo/apt/ for latest version
RUN aws s3 cp s3://3rdparty-packages/mysql-apt-config_0.8.22-1_all.deb . && \
  DEBIAN_FRONTEND=noninteractive dpkg -i mysql-apt-config_0.8.22-1_all.deb

RUN apt-get update && apt-get install -y --no-install-recommends \
      g++ \
      pkg-config \
      default-libmysqlclient-dev \
      libunistring-dev \
      libboost-all-dev \
      libboost-program-options-dev \
      libffi-dev \
      gcc automake autoconf libtool make \
    && rm -rf /var/lib/apt/lists/*
[...]

error:

  > [ 5/40] RUN apt-get update && apt-get install -y --no-install-recommends       g++       pkg-config       default-libmysqlclient-dev       libunistring-dev       libboost-all-dev       libboost-program-options-dev       libffi-dev       gcc automake autoconf libtool make     && rm -rf /var/lib/apt/lists/*:
14:11:34  #9 1.375 Get:2 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
14:11:34  #9 1.375 Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
14:11:34  #9 1.574 Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8780 kB]
14:11:34  #9 1.698 Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [6408 B]
14:11:34  #9 1.802 Ign:6 http://repo.mysql.com/apt/debian bookworm InRelease
14:11:34  #9 1.834 Get:7 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [87.2 kB]
14:11:34  #9 2.085 Err:8 http://repo.mysql.com/apt/debian bookworm Release
14:11:34  #9 2.085   404  Not Found [IP: 23.78.1.18 80]

Solution

  • The issue, as stated in the comments is the version of the mysql-apt-config downloaded from the S3. Using the official package solves the error:

    wget https://repo.mysql.com/apt/ubuntu/pool/mysql-apt-config/m/mysql-apt-config/mysql-apt-config_0.8.22-1_all.deb