How to Fix Docker 404 Not Found on Ubuntu 22.04
The Root Cause
Ubuntu 22.04 (Jammy Jellyfish) uses the codename jammy for its package distribution. The “Docker 404 Not Found” error during apt update typically occurs because the Docker repository configuration file points to an incorrect or outdated distribution name (e.g., focal for Ubuntu 20.04 instead of jammy), causing the package manager to request a non-existent URL.
Quick Fix (CLI)
# 1. Remove any existing, potentially incorrect Docker repository configuration
sudo rm -f /etc/apt/sources.list.d/docker.list
# 2. Update package lists and install necessary dependencies for secure HTTPS communication
sudo apt update
sudo apt install -y ca-certificates curl gnupg
# 3. Create a directory for GPG keys if it doesn't exist and set correct permissions
sudo install -m 0755 -d /etc/apt/keyrings
# 4. Download and add Docker's official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg # Ensure readable by apt
# 5. Add the Docker repository for Ubuntu 22.04 (jammy)
echo \
"deb [arch=\"$(dpkg --print-architecture)\" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
jammy stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# 6. Update apt package index to refresh with the new Docker repository
sudo apt update
Configuration Check
Examine the contents of /etc/apt/sources.list.d/docker.list. The line defining the Docker repository should specifically reference jammy.
It should look like this (architecture may vary):
deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy stable
If you see focal, bionic, or any other distribution name instead of jammy, that was the core misconfiguration.
Verification
sudo apt update
If the output of apt update completes without a 404 Not Found error related to download.docker.com, the repository configuration has been successfully corrected. You can then proceed to install Docker Engine if it’s not already installed.