Quick demo of Docker Cloud

Prerequisites:

  • Azure account (see guide in a previous post)
  • GitHub account
  • Docker Cloud account (see the above link)
  • Docker Cloud integrated with GitHub and Azure (see the above link)
  • Visual Studio 2015 with .NET Core SDK and Docker tooling

Goals:

  • Create a new repository
  • Create a .NET Core web API
  • Run the .NET Core web API in a Container in a Cloud

Create the project and add the new repository to GitHub:

Click “Publish” and now there is a new repository in GitHub. Next up is Docker Cloud.

First we create a new Docker Hub repository directly in Docker Cloud:

Click “Create”

Click “Link to GitHub”

Tip: If your repository is not showing up, then you must first grant access in GitHub:

Ok, back to Docker Cloud. Select “SOURCE REPOSITORY“:

Select a “BUILD LOCATION” to “Small” and Click “Save”.

Several things just happened, most notably is that this Docker Hub repository will build every time someone commits code to the GitHub repository.

But first the .NET Core web API needs to contain a “Dockerfile” that looks like this

This file is now inserted into the root folder of the .NET Core solution.

Commit this file to GitHub and it will trigger a Build in Docker Cloud(Hub).

The Container image only takes a few minutes to build.

Next, the Container images needs somewhere to run. Create a Node Cluster:

Click “Launch node cluster”

This takes a few minutes to start up. In the meantime the Container image is finished:

We are ready to deploy the .NET Core web API when the Node Cluster itself is deployed.

Click “Launch service”

By default the Port is not open so we need to change that to this.

Here the Container port is now published/visible to the Docker Host which makes it reachable from the internet.

Click “Create & Deploy” for the finishing move.

And it’s starting up.

Go to the “Timeline” to see what is happening:

After a 2-3 minutes it’s running and ready to be tested.

Click on the “link” in the red circle, and remove the “tcp://” in:

Add “/api/values” to the URL and behold!

The Container is now running in a Container in Azure with a complete automatic CI/CD pipeline?

Thank you for reading.

Leave a Reply

Your email address will not be published. Required fields are marked *