Skip to main content

Command Palette

Search for a command to run...

Installing Docker on Ubuntu

Straight-forward steps to installing docker on an ubuntu machine

Published
1 min read
Installing Docker on Ubuntu
J

John Johnson Okah is an enthusiastic Software Developer with 3+ years of experience and a focus on web design, artificial intelligence, and machine learning.

Step 1: Uninstall Old Versions

sudo apt-get remove docker docker-engine http://docker.io containerd runc

Step 2: Update apt package and install dependencies

sudo apt-get update
 sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

Step 3: Add Docker's official GPG key

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Step 4: Setup the repository

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Step 5: Install Docker Engine

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli http://containerd.io docker-compose-plugin

Step 6: Test the Installation

sudo service docker start
sudo docker run hello-world

Step 7: Add your user to the Docker group

sudo usermod -aG docker $USER

PS: when you log out and back in, you should be able to run docker commands without sudo


Now Docker has been successfully installed on your Ubuntu system 🍻

More from this blog

J

JJ𝚯KAH's Blog

14 posts

…a Story and Software Engineer dedicated to creating value for humanity.