How To Install Docker on Ubuntu Server (3 Easy Steps)

NetShop ISP
2 min readJul 11, 2023

--

In this article we will demonstrate the steps you need to execute on your Ubuntu server to install and run Docker on your machine.

Docker is an open platform for developing, shipping, and running applications. It enables you to separate your applications from your infrastructure so you can deliver software quickly. In simple words, Docker is a cost-effective alternative to hypervisor-based virtual machines. You setup you desired applications and recipes in containers which you can then deploy in a single click.

Steps to Install Docker Engine on Ubuntu Server via apt repository

Requirements & Pre-requisites

  • Virtual machine or Dedicated server
  • Works only on Ubuntu Focal 20.04, Ubuntu Jammy 22.04, Ubuntu Kinetic 22.10 and Ubuntu Lunar 23.04
  • SSH access on your server with root or sudo user

Step 1. Update system and install required libraried

root@ubuntu:~$ apt-get update -y
root@ubuntu:~$ apt-get install ca-certificates curl gnupg -y

Now you need to add Docker’s official GPG key:

root@ubuntu:~$ install -m 0755 -d /etc/apt/keyrings
root@ubuntu:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
root@ubuntu:~$ chmod a+r /etc/apt/keyrings/docker.gpg

Execute the following command to setup the Docker repository for Ubuntu:

root@ubuntu:~$ echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null

Step 2. Install Docker Engine

Once the Docker repository is installed from previous step, execute the following command to update your system:

root@ubuntu:~$ apt-get update -y

Now, let’s install Docker engine, containerd and Docker Compose:

root@ubuntu:~$ apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

Step 3. Verify Successful Installation (optional)

At this point you will want to verify that Docker has been successfully installed on your Ubuntu server.

The following command will download a test image and run it as a container. Once the container runs, will print a confirmation message.

root@ubuntu:~$ docker run hello-world

You should see an output similar to this:

Docker hello world successful output

Congratulations! You have successfully installed Docker engine on Ubuntu server!

Source: https://netshop-isp.com.cy/blog/how-to-install-docker-on-ubuntu-server/

--

--

NetShop ISP
NetShop ISP

Written by NetShop ISP

Web Hosting, Servers, Colocation & Data Center Services (www.netshop-isp.com.cy)

No responses yet