Skip to main content

140. Docker Repository Ubuntu Version Fallback

Status: Accepted Date: 2025-07-06

Context

When a new version of Ubuntu is released (e.g., 24.04 "Noble Numbat"), there is often a lag before official third-party software repositories, like Docker's, add a specific release channel for that new version. When our Ansible automation runs on a brand new Ubuntu release, the task to add the Docker APT repository might fail because a "noble" release channel does not yet exist.

However, the Docker packages built for the previous LTS release (e.g., 22.04 "Jammy Jellyfish") are often compatible with the new release.

Decision

The 08_docker Ansible role will implement an Ubuntu version fallback mechanism for adding the Docker APT repository.

The Ansible task will be configured to:

  1. Try to add the repository using the codename of the current Ubuntu release (e.g., noble).
  2. If this fails, it will automatically fall back and try again using the codename of the previous LTS release (jammy).

This is accomplished by using a variable for the release codename and a conditional check. This makes the automation resilient to the lag in repository updates, allowing us to provision new Ubuntu releases as soon as they are available.

Consequences

Positive:

  • Increased Resilience: Makes the provisioning process much more robust and forward-compatible. We don't have to wait for Docker to officially support a new Ubuntu version to start using it.
  • Reduced Maintenance: We don't have to manually update the Ansible role with a hardcoded version name every time we adopt a new Ubuntu release. The fallback logic handles it automatically.
  • Pragmatic Solution: Acknowledges the reality of release cycles and provides a simple, effective workaround.

Negative:

  • Using "Unsupported" Packages: We are knowingly installing packages that were built for a previous OS version. While this generally works fine for consecutive LTS releases, there is a small risk of incompatibility.
  • Adds Complexity: The Ansible task for adding the repository is more complex than a simple, single-line command, as it has to incorporate the fallback logic.

Mitigation:

  • Low Risk of Incompatibility: The risk of incompatibility for Docker packages between modern Ubuntu LTS releases is very low. This is a widely used and accepted practice in the community. We would, of course, test the provisioned system thoroughly.
  • Temporary Workaround: This fallback is intended as a temporary measure. Once Docker officially adds a repository for the new Ubuntu release, we can update our variable to use it directly. The fallback logic will then simply not be triggered. The complexity is contained and justified by the problem it solves.