Installing Docker on Ubuntu 24.04 is not that difficult. This short article will step you through the steps necessary to get the current version installed properly.
The video walks through the following topics:
- Introduction
- Remove any pre-existing unofficial docker packages
- How to add the official Docker apt repo
- How to install docker
- Test docker installation
- how to add user to docker group
- Activate new group membership immediately
Docker Install Documentation: https://docs.docker.com/engine/install/ubuntu/
Remove any unofficial docker packages
1for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
Add the official Docker apt repository
1# Add Docker's official GPG key:
2sudo apt update
3sudo apt install ca-certificates curl
4sudo install -m 0755 -d /etc/apt/keyrings
5sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
6sudo chmod a+r /etc/apt/keyrings/docker.asc
7
8# Add the repository to Apt sources:
9echo \
10 "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
11 $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
12 sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
13sudo apt update
Install latest version of Docker
1sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Add yourself to the docker group
1# The following adds the currently logged in user to the docker group
2usermod -aG docker $LOGNAME
3# This command immediately activates your membership in the docker group,
4# allowing you to run the docker command with the need for sudo
5newgrp docker
Verify Docker installation
In order to verify the installation, attempt to run a simple test container:
1docker run hello-world
If you receive an error like: docker: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock..... then your user id is not being seen as a member of the docker group. This means either you didn't run the "newgrp" command or you just need to reboot
What success looks like
Here’s what a successfull docker run will look like for the test command:
1❯ docker run hello-world
2Unable to find image 'hello-world:latest' locally
3latest: Pulling from library/hello-world
4c1ec31eb5944: Already exists
5Digest: sha256:53cc4d415d839c98be39331c948609b659ed725170ad2ca8eb36951288f81b75
6Status: Downloaded newer image for hello-world:latest
7
8Hello from Docker!
9This message shows that your installation appears to be working correctly.
10
11To generate this message, Docker took the following steps:
12 1. The Docker client contacted the Docker daemon.
13 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
14 (amd64)
15 3. The Docker daemon created a new container from that image which runs the
16 executable that produces the output you are currently reading.
17 4. The Docker daemon streamed that output to the Docker client, which sent it
18 to your terminal.
19
20To try something more ambitious, you can run an Ubuntu container with:
21 $ docker run -it ubuntu bash
22
23Share images, automate workflows, and more with a free Docker ID:
24 https://hub.docker.com/
25
26For more examples and ideas, visit:
27 https://docs.docker.com/get-started/
The following are affiliate links. Any revenue generated via the links below will help pay for systems and services used in the hosting and production of my content:
- RackNerd VPS, CPanel Shared Hosting: https://bit.ly/dqRackNerd
- Domain Registration, CPanel Shared Hosting, VPS, SSL via NameCheap: https://bit.ly/dqNameCheap
My Gear
Please Note: As an Amazon Associate, I earn from qualifying purchases.
- USB Capture Device: https://amzn.to/3NFvdpR
- Standing Desk: https://amzn.to/3hBXFJG
- 34in Monitor: https://amzn.to/3HBCwKj
- Thunderbolt 3 Dock: https://amzn.to/36W7YXb
Workstation Build:
- Full Tower Case: https://amzn.to/3vqJtKM
- MB: https://amzn.to/3WSpNuY
- CPU: https://amzn.to/3jCvij4
- Cooler: https://amzn.to/3i1gyJW
- Memory: https://amzn.to/3WQtBg5 (X2 for 128GB)
- GPU: https://amzn.to/3G2f5v8
- PSU: https://amzn.to/3PY54nf
- Cache (nvme): https://amzn.to/3vn1qd2
- OS (nvme): https://amzn.to/3vnDUwr
- Data (SSD): https://amzn.to/3C9Ae5e (X2)
- Keyboard: https://amzn.to/347VfPA
- Mouse: https://amzn.to/3C8KzgH
- Microphone: https://amzn.to/3JD4Myv