Problems running .Net Core project in a docker container: String was not recognised as a Boolean.

April 28, 2019 0 By Toby Worth

I’ve been building a docker image of my Identity server 4 STS project to form part of an orchestrated cluster: IS4, AdminUI, API and Front end/Static file server.

I’ll be posting about the other issues, but am currently getting an error when running ‘docker run myapp:dev’:

The key part is “System.FormatException: String was not recognized as a valid Boolean”. This occurred during the ConfigureServices startup call.

This seems related to the appSettings.json file, since that’s the only area I have strings being parsed (even if there are no actual booleans in it). The project fine in Visual Studio, so it’s obviously something wrong with the build process in docker.

Sure enough, I had forgotten to add the environment variables to the docker file. I think the only one that was necessary was:


During the final build stage (i.e. the last FROM step that ends with the ‘dotnet’ run or run dll statement).