CI using Docker

We are going to create a CI build for a DotNetCore website running in a docker container. Pushed to our private registry (so no dockerhub is necessary).

To use docker we must first create a “Azure Container Registry”
in the go to new and select the “Azure Container Service”

Choose create and fill in the required parameters and press ok.
After deployment go to the created resource -> access key -> enable admin user

Now we can use the generated username and password to create a enpoint in our vsts.
Go to settings -> services -> new service endpoint -> Docker registry

Use the user name, password and url from the portal to fill in the parameters and press ok.

Download and add this source code to your repository.

Create a new build definition and add tasks to look like this

First command:

Second command:

First Docker:

Second Docker:

Third Docker:

Copy publish artifact:

Add a variable to your build “DockerRegistryUrl” with the url of the docker registry.

In General make sure you choose the “Hosted Linux Preview” because the normal hosted agents don’t support docker (yet)

Queue a new build in the azure portal you can see on the disk that the new image is created.