The Best Way To Setup Docker On Ubuntu Linux

Mark Harwood
3 min readJul 9, 2024

As someone that’s created a lot of Docker instances on Linux, the method is now second nature to me. But at one time I had no idea on the best way to setup Docker on Ubuntu Linux.

I tried a ton of methods and tutorials, with all of them missing something. This often lead to installs not working quite right or being hard to scale.

I wanted to share with you my method for installing Docker on Ubuntu Linux. I’ve also written this on my website in case you prefer reading over there.

Introduction

So as an overview, I will be using Ubuntu 22.04 but you can use the latest 24.04 if you like. The general flow of this setup will be to update Linux and create the directories that are needed. Once that’s done, we can set the permissions and start adding docker to our apt-get repository.

Lets jump in now!

The Best Way To Setup Docker On Ubuntu Linux

First things first, is to update your Ubuntu machine. You could skip this step is are sticking to a particular release, but I always take the opportunity out of best practice.

Update Ubuntu

To update Ubuntu, run the below commands:

sudo do-release-upgrade
sudo apt-get update; sudo apt-get upgrade

You might also be prompted on either of those commands, just press ‘Y’ and then…

--

--

Mark Harwood

IT Pro 👨‍💻 Dad 👀 Husband🔒 Check out my free blog or utilise my expertise on the web! https://mharwood.uk