Install the latest version of the Docker engine: 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
<p>When that completes, you're ready to move on. </p><h2> How to add the necessary repository </h2><p>With Docker removed, we can add the necessary repository. First, add the GPG key with the command: </p><pre class="code">curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg</pre> <p>Next, add the repository: </p><pre class="code">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</pre> <h2> How to install the latest Docker engine </h2><p>We're going to install a few dependencies first. This is done with the command: </p><pre class="code">sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y</pre> <p>Finally, we can install the latest version of the Docker engine: </p><pre class="code">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
<p>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).
<h2> Also see </h2> </div>