How can I disable Docker from a Visual Studio ASP.NET Web API application?
Asked Answered
H

3

5

When I have created a ASP.NET Web API application, I have checked to enable Docker for the project, not really knowing what that does. Now, I cannot start my application, becasue when I run it, I have the following error:

Error   CTC1003 Visual Studio container tools require Docker to be running. 

How can I disable Docker from the project?

Hypochromia answered 4/10, 2021 at 19:24 Comment(0)
H
7

What you've accidentally done is added support for containerizing your web API in a Docker container. Follow this to remove that support.

  1. Remove lines that look like this from your .csproj files
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
  1. Remove these files if present, from solution and physical folder where the solution is homed.
    • docker-compose.dcproj
    • dockerfile.
    • .dockerignore
    • Dockerfile.build
  2. Inside your project node there should be a Properties\launchsettings.json entry. Edit this to remove the "Docker" JSON element.

Finally, close and reopen the solution to make sure there are no mistakes, rebuild, and try to run. The profile that gets run is defined in launchsettings.json and is controlled by selecting the profile on the Debug toolbar (there may be other ways).

If none of that works, I suggest deleting (after backing up) and recreating the project without checking the Docker option.

Homochromous answered 4/10, 2021 at 19:45 Comment(1)
In VS22 I had a similar problem. I deleted everything like described above, but in lauchsettings the docker entry were inserted again. Then I found a csproj.user file with a docker entry as the ActiveDebugProfile. So removing the csproj.user file solved the problem.Pinfeather
T
5

enter image description here

The problem is that your application is trying to run with docker engine. Just: check the attached image

Change the target to IIS.

Tiga answered 13/7, 2023 at 11:2 Comment(1)
Correct. Set the project as startup project. Then you will see the Docker text in Run button. Change it. Then set up your correct startup projects in the solution again. Then everything will work. This is the correct solution!Birkett
T
0

There is alternative solution for this, please do the following two steps: 1- Execlude the docker file from the project. 2- From the properties folder, open the launchSettings.json file and comment the docker section

Or simply change the runner from container (Docker file) to https

Enjoy.

Tetrastich answered 6/8 at 6:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.