How to Install Docker on Ubuntu

In today’s fast-paced technological landscape, Docker has emerged as a powerful tool for developers and sysadmins alike. It allows you to package, distribute, and manage applications in lightweight containers.

If you’re using Ubuntu, a popular Linux distribution, you’re in luck. This article will guide you through the straightforward process of installing Docker on your Ubuntu system.

Update Package Repositories

Before diving into the Docker installation, it’s a good practice to update your system’s package repositories. Open up your terminal and type in the following command:

sudo apt update

Install Prerequisites

Docker requires a few prerequisites to ensure its smooth functioning. Let’s install them using this command:

sudo apt install apt-transport-https ca-certificates curl software-properties-common

Add Docker Repository

To get the latest Docker version, you’ll want to add the Docker repository. Execute these commands one by one:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=amd64 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

Install Docker Engine

Now comes the exciting part – installing Docker Engine. Run these commands to complete the installation:

sudo apt update sudo apt install docker-ce

Start and Enable Docker

You’re almost there! Start the Docker service and enable it to start on boot using these commands:

sudo systemctl start docker sudo systemctl enable docker

Verify Docker Installation

To make sure Docker is up and running, run a simple “Hello World” container:

sudo docker run hello-world

Conclusion

Congratulations! You’ve successfully installed Docker on your Ubuntu system. This versatile tool opens up a world of possibilities for managing and deploying applications in a more efficient and isolated manner. Now you’re all set to explore the world of containers and take your development projects to the next level. Happy coding!