|

How to Install Docker on Ubuntu

Docker is a powerful containerization platform that allows you to package and run applications and their dependencies in isolated containers. It’s widely used for simplifying application deployment and managing complex software environments. In this guide, we’ll walk you through the steps to install Docker on Ubuntu.

Update Your System

First, let’s ensure your system is up to date:

sudo su
apt update && apt upgrade -y && apt autoremove -y

These commands update the package repository, upgrade installed packages, and remove any unnecessary packages, keeping your system secure and efficient.

Install Prerequisites

Docker requires some additional packages to be installed. Let’s get those:

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

These packages enable secure communication with Docker’s package repository.

Add Docker Repository

To install Docker, we’ll add Docker’s official repository to your system:

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

These commands fetch Docker’s GPG key and add the Docker repository to your system’s package sources.

Install Docker

Now, we can install Docker and its command-line tools:

apt update
apt install -y docker-ce docker-ce-cli containerd.io

These commands will download and install Docker on your Ubuntu machine.

Start and Enable Docker

Start the Docker service and set it to start on boot:

systemctl enable docker
systemctl start docker

Verify Docker Installation

o ensure that Docker is installed and working correctly, you can check its version:

docker --version

This should display the installed Docker version.

Grant Docker Permissions (Optional)

If you want to run Docker commands without using sudo, add your user to the docker group:

exit #back to normal user
sudo usermod -aG docker $USER

This change will take effect after you log out and log back in.

You’re now ready to start using Docker on your Ubuntu machine. Docker allows you to create and manage containers for your applications, making it easier to develop, deploy, and maintain software in a consistent and isolated environment. Enjoy containerizing your applications with Docker!

Install Uptime Kuma (Optional)

docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *