diff --git a/containers/debian/base.Dockerfile b/containers/debian/base.Dockerfile
index f25a14aae10e58732ee2a37f0d939cb2c537d2fd..33506a4f6a4b7e37cfb5806aab6f3654eb04d86e 100644
--- a/containers/debian/base.Dockerfile
+++ b/containers/debian/base.Dockerfile
@@ -75,16 +75,17 @@ mkdir -p /etc/apt/source.list.d
 # GCC version and repository
 case ${ID} in
   debian)
-    case ${VERSION_ID} in
-      12) GCC="-12" ;;
-      *) echo "Unsupported VERSION_ID=${VERSION_ID}" ; exit 1 ;;
+    case ${VERSION_CODENAME} in
+      bookworm) GCC="-12" ;;
+      trixie) GCC="-13" ;;
+      *) echo "Unsupported VERSION_CODENAME=${VERSION_CODENAME}" ; exit 1 ;;
     esac ;;
   ubuntu)
     echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/ppa/ubuntu/${VERSION_CODENAME} main" > /etc/apt/source.list.d/ubuntu-toolchain.list
-    case ${VERSION_ID} in
-      20.04) GCC="-10" ;;
-      22.04) GCC="-12" ;;
-      *) echo "Unsupported VERSION_ID=${VERSION_ID}" ; exit 1 ;;
+    case ${VERSION_CODENAME} in
+      focal) GCC="-10" ;;
+      jammy) GCC="-12" ;;
+      *) echo "Unsupported VERSION_CODENAME=${VERSION_CODENAME}" ; exit 1 ;;
     esac ;;
   *) echo "Unsupported ID=${ID}" ; exit 1 ;;
 esac