Foto: MastaBaba via Flickr (CC BY-NC 2.0)
Why You Need Docker in Your Dev Toolkit
So, you’ve just installed Ubuntu 24.04 and you’re ready to start building something cool. But then you hit a wall: ‘It works on my machine, why doesn’t it work on the server?’
This is where Docker comes to the rescue. Think of Docker as a high-tech shipping container for your code. Instead of worrying about dependencies, you just pack everything into a container and ship it anywhere.
In this guide, I’m going to walk you through the installation process like we’re grabbing a coffee. No complex jargon, just straight-to-the-point steps to get you up and running.
Preparing Your Ubuntu System
Before we dive into the installation, we need to make sure your system is clean and ready to roll. We’ll start by updating your local package index to ensure we’re getting the latest versions of everything.
Open your terminal (Ctrl+Alt+T) and run these commands to get your system up to speed:
sudo apt update && sudo apt upgrade -y
This ensures that your existing software is current, which prevents conflicts during the installation process. It’s a simple step, but skipping it is a recipe for headache later on.
Step 1: Installing Prerequisite Packages
Docker needs a few extra tools to communicate securely with your system’s software repositories. We need to install apt-transport-https, ca-certificates, curl, and gpg.
Run this command to get them all at once:
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
Once that’s done, your system is much better equipped to handle the official Docker repository. You’re halfway there!
Pro Tip: Always run your updates before installing new software. It saves you from unexpected errors and broken dependencies.
Step 2: Adding the Official Docker Repository
Now, we don’t want to just grab any random version of Docker from the default Ubuntu stores. We want the official version directly from the source to ensure maximum stability and security.
First, let’s add Docker’s GPG key. This key acts like a digital signature that proves the software hasn’t been tampered with.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Next, we add the repository to our system’s list of sources. This tells Ubuntu exactly where to look when you type ‘install docker’.
echo ""sudo deb [arch=$(dpkg --print-architecture) 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
Step 3: The Main Event – Installing Docker
This is the exciting part! Now that your system knows where to find the official files, we can finally install the engine itself.
First, update your package index again so it recognizes the new Docker repository we just added:
sudo apt update
Now, run the final command to install the Docker Engine:
sudo apt install docker-ce docker-ce-cli containerd.io -y
Once the installation finishes, let’s verify that everything is working perfectly. If you see a version number, you’ve succeeded!
docker --version
Step 4: Post-Installation: Running Docker Without Sudo
By default, you have to use sudo every single time you run a Docker command. That gets annoying very quickly when you’re trying to be productive.
To fix this, we can add your user to the docker group. This gives your user permission to talk to the Docker engine directly.
- Create the docker group (it might already exist):
sudo groupadd docker - Add your current user to the group:
sudo usermod -aG docker $USER - Apply the changes:
newgrp docker
Now you can simply type docker run hello-world to test it out without needing sudo!
Conclusion: You’re Ready to Containerize!
Congratulations! You’ve successfully installed Docker on Ubuntu 24.04. You’ve gone from a fresh OS to a fully functional container environment in just a few steps.
Now that you have Docker running, the world is your oyster. You can pull images for databases, web servers, or even complex AI environments with a single command.
What’s next? I highly recommend playing around with Docker Compose to manage multiple containers at once. Happy coding!


