6 MONTHS AGO

Adding Docker support to Kentico

With the release of Visual Studio 2017, it has become child's play to add Docker support to your projects. In this post I will be highlighting the steps to add Docker support to a Kentico v10 web application. I will also provide some troubleshooting tips that I encountered in my trip with Docker containers.

Before we begin you might wonder what the purpose of all this is. For me the main reason is the way how it ties into the whole DevOps concept. For example Docker will prevent me and my team from writing instructions on e.g. the IIS setup that everyone needs to have to get the project up and running. Plus it's super easy (and fun) to get started with Docker.

Prerequisites: Visual Studio 2017, Docker and Kentico.

Visual Studio 2017 is your new best friend

The first step is simple: fire up your Kentico project with Visual Studio 2017. Next right-click the project, select add → Docker Support:

Add Docker Support

This will add serveral Docker files including the Dockerfile and docker-compose.yml. Notice that the "Start" button will provide a Docker option. Simply press it or hit CTRL+F5 to initialize Docker.

Note: The first time will take a while, because the required images will be downloaded. Please ensure you have enough space on your hard drive and grab some coffee :)

When the process is done, grab the IP-address from the output window and use it to navigate to your freshly compiled Kentico site running inside a Docker container:

Grab IP from Docker output

And that's about it! For more information on Docker and Kentico, I highly recommend the blog post from Petr Svihlik: running Kentico in a Docker container.

Troubleshooting tips

Issue #1: Microsoft.DotNet.Docker.CommandLineClientException: Network nat declared as external, but could not be found.
Fix: Run "docker network create nat" from the command line

Issue #2: Unknown Blob when pulling ...
Fix: Right-click Docker icon in the task tray and click on Switch to Windows containers...