install: Detect Ubuntu codename without /etc/lsb-release

Ubuntu 26.10 (stonking) images no longer ship /etc/lsb-release, and
the base image has no lsb_release command.
Both codename lookups returned nothing, so the apt source line had no
suite and apt-get update failed:

```
deb [...] https://download-stage.docker.com/linux/ubuntu  test
E: Malformed entry 1 in list file /etc/apt/sources.list.d/docker.list (Component)
```

Read VERSION_CODENAME from /etc/os-release first, which every supported
Ubuntu release provides and get_distribution already relies on.
lsb_release and /etc/lsb-release remain as fallbacks when os-release has
no codename.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski committed 2026-10-13 18:48:51 +02:00
1 parent 2b32480025
commit af185b580a
1 file changed
+4 -1
+4 -1
View File
@@ -507,7 +507,10 @@ do_install() {
case "$lsb_dist" in
ubuntu)
if command_exists lsb_release; then
if [ -r /etc/os-release ]; then
dist_version="$(. /etc/os-release && echo "$VERSION_CODENAME")"
fi
if [ -z "$dist_version" ] && command_exists lsb_release; then
dist_version="$(lsb_release --codename | cut -f2)"
fi
if [ -z "$dist_version" ] && [ -r /etc/lsb-release ]; then