"Docker support must be enabled" in trying to publish to Azure App Service Container from Visual Studio

84 Views Asked by At

In a new "Hello World" Blazor Web App in .NET 8 (with SDK 8.0.202 and VS Pro), after adding Docker Support with the .NET SDK container build type...

enter image description here

That results in the settings being added to SzBlazor.pubxml, launchsettings.json, and also the .csproj of my Blazor server app. I can then run it locally in a container just fine. When I then try to publish the server app as an Azure App Service Container, I get:

Publish has encountered an error. Docker support must be enabled in the project. See https://aka.ms/vs-add-docker for information on adding Docker support to the project.

"Docker support must be enabled"? It already is. Yet the publish UI perhaps doesn't see that. Of course, there seems to be nothing helpful at that URL.

Also, I have Rancher Desktop instead of Docker Desktop.

Any ideas?

1

There are 1 best solutions below

0
On

I have tried to implement the same in my environment but getting the error while deploying the Blazor to Azure with Container (.NET SDK).

  • As per my observation, the publish profile is looking for Docker file during the deployment.

  • Hence, I have enabled Docker file support and able to deploy to Azure App Service Container.

  • Or you can first deploy the application to Azure Container registry and then deploy the image to Azure App Service manually, it will allow you to deploy with .NET Container SDK:

enter image description here

enter image description here enter image description here

  • Go to Azure App Service in Portal and create a new App Service.
  • Select Container as Deployment method and Azure Container registry as Image source. Select the registry of your application.

enter image description here

Portal:

enter image description here