Installing Docker on an Ubuntu-based Azure Virtual Machine

Ashwin Srinivasan
2 min readFeb 21, 2024

In this guide, I will walk you through installing Docker on an Ubuntu-based Azure Virtual Machine. We’ll cover the steps to set up Docker on Ubuntu, including configuring the VM and installing Docker Engine, so you can quickly begin deploying and managing containers.

How to Provision an Ubuntu on Azure VM

  1. Navigate to the Azure Portal
  2. Click on Create a Resource
  3. On the page, search for Virtual Machine or select Virtual Machine if visible.
  4. Create a new Resource Group on the Basics page or select an existing one.
  5. Provide a virtual machine name
  6. Select the appropriate region
  7. In the Availability options, select — “No infrastructure redundancy required”.
  8. In the image, select “Ubuntu Server”.
  9. In the Authentication type, select “Password”.
  10. In the allowed ports, select SSH (22) & HTTP (80)
  11. Leave all other options as-is and move on to the final tab, “Review + Create” and provision the VM

Connecting to the Ubuntu VM

  1. Open the Putty app
  2. Copy the public IP from the Ubuntu VM
  3. Paste the public IP
  4. Enter your username and password and hit connect

Installing Docker on Ubuntu

  1. for installation, paste the following code. The installation code is taken from the Docker website
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
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

# Add the 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

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

Verify the installation

to verify if the installation was successful, run the following command

sudo docker run hello-world

--

--

Ashwin Srinivasan

Tech enthusiast exploring digital realms, sharing knowledge, and embracing innovation. 🚀 #TechJourney