Setting up Docker on Azure with Ubuntu server

Here are instructions to setup your own Docker on Azure with an Ubuntu server.

Build a new Ubuntu Server

Log on your Azure portal and go to Marketplace. Search for ubuntu and select a version you want.

Click Create.

Input your VM name, user name, and resource group. Select your preferred location if needed.

Select your preferred authentication type:

SSH public key

Open Terminal (on Mac) or Git Bash (on Windows) and input command ssh-keygen -t rsa -b 4096 -C “

Copy public key using command:

Mac: pbcopy < ~/.ssh/
Git Bash: clip < ~/.ssh/

Paste the public key in SSH public key field.


Click OK to go to step 2 and choose your VM size. You may start with the smallest one as you can scale it up later.

You can leave default settings in step 3.

Click OK to start deployment.

It will take around one minute to finish the deployment.

Install Docker on Ubuntu

Open the VM and note the IP address. (You may assign a sub domain name and/or make the IP static by clicking it.)

You can connect to Ubuntu with ssh command:

SSH Authentication: ssh username@IPAddress -i ~/.ssh/privatekey
Password Authentication: ssh username@IPAddress

Use command docker to see if a docker is installed. If not, it will show you the command to install it.

Before installing docker, upgrade the system with command sudo apt update and sudo apt upgrade.

After the upgrade is done, install docker using command sudo apt install

Test docker by running hell0-world application using command sudo docker run hello-world.

Note: My instructions show how to install docker from Ubuntu repository which may not be the latest version. To install the latest version, please refer to the instructions from here or here.