Blazor client in Docker container

Claes Ylving 21 Reputation points

I have VS 2019 Version 16.10.1, Docker Desktop

  1. Create new project, choose Blazor WebAssembly App (.NET 5.0)
  2. Right click project in solution explorer choose Add-> Docker Support and choose Linux
  3. Compiles fine and runs when you select "IIS Express"
  4. Choose Docker instead of IIS Express and run

Fails with a dialog stating
"The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core."

Can not get it to work.


Microsoft Technologies based on the .NET software framework.
3,458 questions
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,420 questions
{count} votes

Accepted answer
  1. Bruce ( 57,886 Reputation points

    a blazer web assembly app is a static website. it requires a Web server to host it. so to deploy to docker container, you need to pick a container with web server support (typically ngnix), and copy the wwwroot folder to a location folder defined in the webserver.

    the default docker public assumes you are building a .net core app.

    assuming you are in the built wwwroot folder, create a docker file like:

    FROM nginx:alpine
    COPY . /usr/share/nginx/html

    that should do it. if you google, you could create a script to build and deploy. if you add a Dockerfiles you can run from the project file.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful