DEV Community

Cover image for Straight-forward steps to installing docker on an Ubuntu machine
John Johnson Okah
John Johnson Okah

Posted on

2 2

Straight-forward steps to installing docker on an Ubuntu machine

Step 1: Uninstall Old Versions

sudo apt-get remove docker docker-engine http://docker.io containerd runc
Enter fullscreen mode Exit fullscreen mode

Step 2: Update apt package and install dependencies

sudo apt-get update
Enter fullscreen mode Exit fullscreen mode
 sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
Enter fullscreen mode Exit fullscreen mode

Step 3: Add Docker's official GPG key

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

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
Enter fullscreen mode Exit fullscreen mode

Step 5: Install Docker Engine

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

Step 6: Test the Installation

sudo service docker start
Enter fullscreen mode Exit fullscreen mode
sudo docker run hello-world
Enter fullscreen mode Exit fullscreen mode

Step 7: Add your user to the Docker group

sudo usermod -aG docker $USER
Enter fullscreen mode Exit fullscreen mode

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 🍻

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

đź‘‹ Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay