Install the latest version of the Docker engine to avoid vulnerabilities
If you’re a container developer, you should always have the latest version of the runtime engines you use. Jack Wallen shows you how to get that most up-to-date version of Docker installed.
Ubuntu is a great Linux for numerous purposes. For the desktop, for servers, for production, for operations, for development and for deploying Docker containers. But there’s one thing you must know about Ubuntu. Although it’s a rock-solid, incredibly user-friendly operating system, the available software isn’t always the latest-greatest. You might even find, in some instances, that software is a few releases behind. Why? Because the developers want to ensure your experience is always the best it can be.
SEE: Checklist: Server inventory (TechRepublic Premium)
Take, for instance, my Pop!_OS (based on Ubuntu 21.04) version of Docker is 20.10.2. The most recent Docker release, however, is 20.10.7 (released June 6, 2021). Now that point release may or may not contain bold new features, but it will certainly include bug fixes and various patches. In certain circumstances, it might behoove you to always have the latest version of Docker installed (especially given the mercurial nature of container security.
So how do you install the latest version of the Docker engine on Ubuntu? Let me show you how.
What you’ll need
To get the latest version of the Docker engine on Ubuntu, you’ll need the following:
- A running instance of Ubuntu (it doesn’t matter if it’s Server or Desktop).
- A user with sudo privileges.
That’s it. Start your engines.
How to remove the current Docker installation
To install the latest version, you must first purge the current installation. Log in to your Ubuntu instance, open a terminal window, and issue the command:
sudo apt-get remove --purge docker docker-engine docker.io -y
When that completes, you’re ready to move on.
How to add the necessary repository
With Docker removed, we can add the necessary repository. First, add the GPG key with the command:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Next, add the repository:
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
How to install the latest Docker engine
We’re going to install a few dependencies first. This is done with the command:
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y
Finally, we can install the latest version of the Docker engine:
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io -y
Notice the above installed the community edition of the Docker engine. That is the best way to ensure you have the latest version of the Docker engine at the ready. When you now run the command docker –version, you should see it listed as 20.10.7 (as of this writing).
To finish things up, make sure your user is still a member of the docker group with the command:
sudo usermod -aG docker $USER
Log out and log back in for the changes to take effect.
And that’s all there is to getting the latest version of the Docker engine installed on Ubuntu. Enjoy knowing you have the most up-to-date installation you can get (without running an unstable, beta release).
For all the latest Technology News Click Here