How to Install Docker Engine on Ubuntu

How to Install Docker Engine on Ubuntu: A Comprehensive Guide

In this guide, we will walk you through the steps to install Docker Engine on Ubuntu. If you prefer to follow these steps through a video tutorial, you can watch the video embedded at the end of this article.v

1. Remove Conflicting Packages

Before installing Docker, it’s important to remove any packages that might conflict with the installation. Run the following command to remove conflicting packages:

$ for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done

2. Set Up Docker’s apt Repository

First, make sure to update your system and install the necessary packages:

$ sudo apt-get update

$ sudo apt upgrade

$ sudo apt-get install ca-certificates curl

Next, add Docker’s official GPG key:

$ sudo install -m 0755 -d /etc/apt/keyrings

$ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc

$ sudo chmod a+r /etc/apt/keyrings/docker.asc

Then, add Docker’s repository to Apt sources:

$ echo \

  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \

  $(. /etc/os-release && echo \"$VERSION_CODENAME\") stable" | \

  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update

3. Install Docker Packages

Now, you can install the necessary packages to set up Docker:

$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

4. Verify the Installation

To verify that the installation was successful, run the hello-world test image:

$ sudo docker run hello-world

After completing these steps, Docker will be successfully installed on your system. For more detailed explanations, feel free to watch the video embedded below where I explain each step in detail.





buy and sell stock without owning it