0

I have an Ubuntu Server v22.04 installation and have recently installed Docker using the docker.io package. When I run docker version i see the following version has been installed

ys-adm@racknerd1:/$ docker version
Client:
 Version:           24.0.7
 API version:       1.43
 Go version:        go1.21.1
 Git commit:        24.0.7-0ubuntu2~22.04.1
 Built:             Wed Mar 13 20:23:54 2024
 OS/Arch:           linux/amd64
 Context:           default

Looking at the the docker.io versions however i see that there are newer versions of docker available.

When I run sudo apt update however it says that all packages are up to date.

$ sudo apt update
Hit:1 http://us.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu jammy-security InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

How do I upgrade to a newer version?

karel
  • 122,292
  • 133
  • 301
  • 332

1 Answers1

0

From your comments, you're looking at the list of all Docker packages in the Ubuntu repositories for all versions of Ubuntu, not just your own you're using. This is normal, because Ubuntu versions tend to not have version bumps on software like Docker and other components.

If you want the latest Docker, you're going to need to forgo the Ubuntu repositories' docker versions and instead use Docker's upstream repositories.

I'll give you the list of instructions and what to run here, but note that these were originally extracted from this page on Docker's website, but are split into clear reasons as to why each step needs to be done.


Make sure you have a supported Ubuntu release!

Docker requires the 64-bit version of one of the following Ubuntu versions:

  • Focal 20.04 (LTS)
  • Jammy 22.04 (LTS)
  • Noble 24.04 (LTS)
  • Oracular 24.10

There is no support for other versions of Ubuntu in the docker repositories at this time.


Remove older Docker versions

Docker provides a bundle of containerd and runc packages that it depends on for containerization. Unfortunately, these conflict with Ubuntu distribution installed Docker packages which aren't considered "official" Docker packages by upstream.

So, we need to uninstall those packages.

for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done

Once this is complete, we can install the official Docker Engine packages.


Install the latest Docker packages - APT method

Ubuntu and Debian both use dpkg and apt/apt-get to update and maintain package repositories and data for the most part. As such, Docker provides an apt repository we can use.

  1. Setup the APT repository.
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

Add the repository to Apt sources:

echo
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" |
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update

  1. Install the Docker packages.
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  1. Make sure Docker works by running the hello-world image.
sudo docker run hello-world

That should leave you with only the latest official Docker packages and not the Ubuntu-shipped 'unofficial' versions that are unlikely to receive frequent updates and patches, and thus won't have newer features or functionality.

Thomas Ward
  • 78,878