The SDK ‘Microsoft.Docker.Sdk’ specified could not be found and other .NET Core/Docker fun…

This is a brief post because it’s the second time I’ve had to resolve the same issue and as I don’t think my memory is getting any better, it’s probably better this goes down on my permanent record. 😉

I love those rabbit holes that you don’t see coming until too late. I had offered to assist with some Docker investigations for another Technical Evangelist at Microsoft. In order to do that I needed to take a currently functional ASP.NET Core site and add docker support.

So easy… Right click to win…


After Visual Studio added the DockerFile and the Docker-Compose scripts, I clicked on the Continuous Delivery Extension and configured the release to deploy using an Azure App Service for Linux. The resulting build would submit a Docker Image to my Azure Container Registry and the Azure App Service for Linux would host this as content. This approach is really attractive as we benefit from the enhanced DevOps story as well as benefiting from features such as SSL termination and App Settings integration.

The extension usually performs a rapid job of created the App Service,  generated a .NET Core build and provisioned a release to to the App Service.

To my disappointment, my first build instead resulted in the following error:

2017-11-07T08:01:53.4574767Z Creating network “devrisecontainer_default” with the default driver
2017-11-07T08:01:53.5054822Z HNS failed with error : The parameter is incorrect.
2017-11-07T08:01:53.5434806Z ##[error]Creating network “devrisecontainer_default” with the default driver

After a bit of messing around I figured out the agent was configured to VS2017 so I set it back to Hosted Linux Preview and kicked off the build again.


The build failed again with a different error:

Creating network “devrisecontainer_default” with the default driver
2017-11-07T07:32:17.4058490Z Pulling ci-build (microsoft/aspnetcore-build:1.0-1.1)…
2017-11-07T07:32:20.2100030Z 1.0-1.1: Pulling from microsoft/aspnetcore-build
2017-11-07T07:33:43.1627390Z Digest: sha256:552e6960be0568f0932536292402753595b8891fe88cf1d4d4a79893fc280626
2017-11-07T07:33:43.1836080Z Status: Downloaded newer image for microsoft/aspnetcore-build:1.0-1.1
2017-11-07T07:33:43.1941150Z Creating devrisecontainer_ci-build_1 …
/usr/share/dotnet/sdk/1.1.4/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.TargetFrameworkInference.targets(112,5): error : The current .NET SDK does not support targeting .NET Core 2.0. Either target .NET Core 1.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.0. [/src/DevRiseContainer/DevRise.csproj]
2017-11-07T07:34:05.9935840Z [36mdevrisecontainer_ci-build_1 exited with code 1
2017-11-07T07:34:06.0031290Z [0mAborting on container exit…
2017-11-07T07:34:06.0478380Z ##[error]Creating network “devrisecontainer_default” with the default driver
As my ASP.NET Core project was targeting version 2.0, the line above rightly indicated that the image being chosen for the build was incorrect. I searched through the code for the image being specified (microsoft/aspnetcore-build:1.0-1.1) and found it in the file. I updated the image value to microsoft/aspnetcore:2.0 and restarted the build.
I received another error:
2017-11-07T08:06:17.1518550Z Status: Downloaded newer image for microsoft/aspnetcore:2.0
2017-11-07T08:06:17.1637510Z Creating devrisecontainer_ci-build_1 …
2017-11-07T08:06:17.8816870Z [36mci-build_1 |[0m Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
2017-11-07T08:06:17.8858550Z [36mci-build_1 |[0m
2017-11-07T08:06:18.1457110Z [36mdevrisecontainer_ci-build_1 exited with code 145
2017-11-07T08:06:18.1593110Z [0mAborting on container exit…
2017-11-07T08:06:18.2085250Z ##[error]Creating network “devrisecontainer_default” with the default driver
2017-11-07T08:06:18.2155070Z ##[error]Pulling ci-build (microsoft/aspnetcore:2.0)…
2017-11-07T08:06:18.2231220Z ##[error]Creating devrisecontainer_ci-build_1 …
The lines in the middle were being reported because the image I had specified only contained the run-time and wasn’t suitable for building ASP.NET Core applications. I updated the image to microsoft/aspnetcore-build:2.0 and queued another build.
To my frustration it failed again with an error that looked almost identical to one we had just resolved.
2017-11-07T08:18:20.6302930Z [36mci-build_1 |[0m /src/docker-compose.dcproj : error MSB4236: The SDK ‘Microsoft.Docker.Sdk’ specified could not be found.
2017-11-07T08:18:27.9507650Z [36mci-build_1 |[0m DevRise -> /src/DevRiseContainer/bin/Release/netcoreapp2.0/DevRise.dll
2017-11-07T08:18:32.4244890Z [36mci-build_1 |[0m DevRise -> /src/DevRiseContainer/obj/Docker/publish/
2017-11-07T08:18:33.0920570Z [36mdevrisecontainer_ci-build_1 exited with code 1
2017-11-07T08:18:33.1045510Z [0mAborting on container exit…
2017-11-07T08:18:33.1606200Z ##[error]Creating network “devrisecontainer_default” with the default driver
Some further research found that this is the result of a known issue in the command-line tooling. I simply had to update the image one last time to a custom image, microsoft/aspnetcore-build:1.0-2.0 that the .NET Core team had created to enable the CI build with Visual Studio.
With a successful build, the continuous deployment then fired and configured our App Service for Linux to point at the delivered container in the Azure Container Registry.
I find it really interesting that these kind of posts are the ones that readers will hit the most. I just hope this post finds people with the same issues I had so you can get back to creating value instead of tricking your tools into working.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s