Update the Docker Engine Version to the latest version on Ubuntu

Syedusmanahmad
2 min readJul 25, 2024

--

Keeping your Docker Engine updated is crucial for ensuring optimal performance, security, and access to the latest features. As a popular containerization platform, Docker frequently releases updates that fix bugs, enhance functionality, and improve overall stability. If you’re running Docker on Ubuntu, knowing how to upgrade to the latest version is essential for maintaining a robust and secure container environment.

WARNING: Docker is warning of a “Critical Docker Engine Flaw Allows attackers to Bypass Authorization Plugins” in the following docker engine versions, so we have to update the docker engine version to the latest Docker version “27.1.1”.

  • <= v19.03.15
  • <= v20.10.27
  • <= v23.0.14
  • <= v24.0.9
  • <= v25.0.5
  • <= v26.0.2
  • <= v26.1.4
  • <= v27.0.3, and
  • <= v27.1.0

First, we will stop the Docker service

service docker stop

Update the apt package

sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release

Add Docker’s official GPG key

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Set up the repository

echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Update and install the latest version of Docker

sudo apt-get update

Run the following command to list all of the available versions of docker-ce and docker-ce-cli

List of all docker version (including latest) at https://docs.docker.com/engine/release-notes/27.1/

apt-cache madison docker-ce
apt-cache madison docker-ce-cli
apt-cache madison docker-ce
apt-cache madison docker-ce-cli

Run the following command to install a specific version of Docker, as I am installing the latest version of “27.1.1”

sudo apt-get install docker-ce=5:27.1.1-1~ubuntu.20.04~focal docker-ce-cli=5:27.1.1-1~ubuntu.20.04~focal containerd.io

Check the docker version now

docker --version
It should be updated to the latest version

Start the docker service

--

--

Syedusmanahmad
Syedusmanahmad

Written by Syedusmanahmad

AWS & DevOps Architect | Linux, Docker, Kubernetes, Terraform, Jenkins, Git&GitHub, Ansible expert

No responses yet