Setting up Docker on Azure with Ubuntu server

Chairat Onyaem
Jul 15, 2017 · 4 min read

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

Remove any installed Docker:

$ sudo apt-get remove docker docker-engine

Install the packages to allow apt to use repository over HTTPs:

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \

Add Docker’s official GPG key:

$ curl -fsSL | sudo apt-key add -

Update one more time:

$ sudo apt-get update

Install the latest version of Docker CE:

$ sudo apt-get install docker-ce

Test it:

$ sudo docker run hello-world

You should see this if everything is working properly:

$ sudo docker run hello-worldHello from Docker!
This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID: more examples and ideas, visit:

Personal blog of a developer who passionate in new practices and technologies

Chairat Onyaem

Written by

Developer —

Personal blog of a developer who passionate in new practices and technologies