Creating Ubuntu Docker VM in Azure

Mission goals:

– use a Linux VM in Azure

– install Docker

– connect via SSH

– install and run an open source system called Staytus

It should be straightforward, but this article is meant to record any ‘quirks’ that might occur through this adventure. This is to make it easier for someone else trying to do the same.

Prerequisites:

– Azure user. Create for free => https://azure.microsoft.com/en-us/free/

If you already have a MSDN sub then you should have some credits available. https://azure.microsoft.com/en-us/pricing/member-offers/msdn-benefits-details/

Ok, I will be short and to the point. Less words more action.

Goto https://azuremarketplace.microsoft.com/en-us/marketplace/apps/CanonicalandMSOpenTech.DockerOnUbuntuServer1404LTS

and start your Linux VM. Usually, this process is painless, and just works.

The result should look like something like this:

image001

Ok, that means that we have a Docker installation in Ubuntu on Azure with the address docker-ubuntu-4ivk4ppp.cloudapp.net

Updated Mission goals:
– use a Linux VM in Azure – OK
– install Docker – OK
– connect via SSH
– install and run an open source system called Staytus

Next, we need to connect to Ubuntu somehow. If you are running Windows 10 I recommend to try out installing Ubuntu ‘natively’ http://www.windowscentral.com/how-install-bash-shell-command-line-windows-10 because it’s fun 🙂

Or just use your Git Bash: ssh <username>@<ip>

     ssh  garg@docker-ubuntu-4ivk4ppp.cloudapp.net

and login.

If you get any password problems, try resetting it in Azure:

image002

If you were successfully you should get this:

image003

Hurray. It also shows that the latest Docker is installed.

Updated Mission goals:
– use a Linux VM in Azure – OK
– install Docker – OK
– connect via SSH – OK
– install and run an open source system called Staytus

Next, we are going to install a fork of Staytus => https://github.com/galexrt/staytus

mkdir git
cd git
git clone https://github.com/galexrt/staytus.git
cd staytus

This fork has a docker-compose.yml that split staytus and its database into two containers instead of the original repository running everything in one container (which is not “best practice” for containerization). Let’s start it!

docker-compose up

This command uses the default docker-compose.yml file.

You should start seeing something like this:

image004

image005

Looking at the running containers, it shows that everything is up and should be ready to use:

image006

It also shows that Staytus running on Port 80 on the Ubuntu, but on Port 5000 inside the Container.

Open it!

Get the IP from Azure Portal and open it in a browser:

image007

Great success! Ok, not really. We have to make some endpoints in Azure. The docker-compose file is already forwarding the container port 5000 to the Ubuntu server (Docker Host) on port 80. This means that in order to access the container we need to access the Port 80 on the Ubuntu server.

image008

Here I have added Port 80 and call it “Staytus”.

Let’s check the browser again:

image009

Updated Mission goals:
– use a Linux VM in Azure – OK
– install Docker – OK
– connect via SSH – OK
– install and run an open source system called Staytus – OK

Whoop whoop!

That was pretty cool. In less than 2 hours including creating this article Staytus is now running. I write slow:)

Breakpoint Bug in Visual Studio 2015

Today I discovered a peculiar bug in Visual Studio 2015. If you put in a very long string:

string strings = @”<very long string at least 80000 characters>”;

it does not stop on Breakpoints anymore:)

Visual Studio 2015 does not throw any errors. It just stops stopping on Breakpoints.

The solution was obviously to put the string in a another file and read it into the program, but still it was a rather fun bug to track down.