BoxBoat Blog

Service updates, customer stories, and tips and tricks for effective DevOps

x ?

Get Hands-On Experience with BoxBoat's Cloud Native Academy

Azure “Cloud Shell” Docker QuickStart Tutorial

by Leon Castellanos | Wednesday, Jun 14, 2017 | Docker Education


Welcome to the BoxBoat QuickStart guide to help get you started with Docker on Azure. Last week we published a Docker QuickStart guide to run NGINX in Docker in less than 5 minutes. If you haven't read that, we highly recommend giving that a quick read.

Let's get an Ubuntu Linux VM with Docker CE running an NGINX container up in Azure using ONLY their “Cloud Shell” feature! This guide assumes that you have a Microsoft Azure account already.

The first thing we need to do is…

Activate Cloud Shell

  1. Launch Cloud Shell from the top right of the Azure Portal:
  2. Select a subscription
  3. Click “Create storage”
  4. Cloud Shell will appear at the bottom of the Azure Portal:

Next we have to configure our VM to auto-update all packages, install and start Docker CE and allow the “azureuser” to run docker commands…

Create a VM cloud-init config file

  1. First create a “cloud-init” directory to store the config file in your “clouddrive”:

  1. Next, using either “vi” or “nano”, create a simple cloud-init config to setup our VM:

Copy and Paste the code below into the file and save it:

package_upgrade: true
- path: /etc/systemd/system/docker.service.d/docker.conf
content: |
- path: /etc/docker/daemon.json
content: |
"hosts": ["fd://","tcp://"]
- curl -sSL | sh
- usermod -aG docker azureuser

Should look like this:

Create the Azure Resources (Resource Group and VM)

  1. First we need a Resource Group for our VM. We'll call it “Docker_RG”. Run the command:
az group create --name Docker_RG --location eastus

  1. Now we're going to create our VM using the cloud-init config file we created previously. Run the command:
az vm create --resource-group Docker_RG --name DockerVM --image UbuntuLTS --admin-username azureuser --generate-ssh-keys --custom-data cloud-init-docker.txt

Access the new VM and test Docker

  1. Get the public IP of your VM and SSH into it:
az vm show --resource-group Docker_RG --name DockerVM -d --query [publicIps] --o tsv
  1. Then SSH into the VM with the IP returned: ssh azureuser@ip
  2. Run some docker commands to test


  1. First we start our NGINX container. From the VM shell run:
docker run -d -p 8080:80 --name nginx nginx
curl http://localhost:8080

  1. Next we need to allow the port we're going to use externally (8080) and test it again with curl and finally a web-browser. Exit the VM shell, if still in it, and run the command:
az vm open-port --resource-group Docker_RG --name DockerVM --port 8080 --priority 1001

Use url http://[IP]:8080 to test with curl or from a browser:

  1. To stop the service, SSH into the VM and stop the container. Run the command:
docker stop nginx

That's all there is to getting Docker CE going on Microsoft Azure in a matter of minutes!

If you need any help, feel free to contact us and also check out the services that we offer.

BoxBoat Accelerator

Learn how to best introduce Docker into your organization. Leave your name and email, and we'll get right back to you.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Get Hands on Training

Learn by doing. Step by step content created by professionals.

Learn More