Reputation:
I have a Web API app written on the top of ASP.NET Core 3.1 framework that I want to run using docker. When I click "Run" using docker, Visual studio fails and logs the following to the debug-window.
C:\Users\myusername.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.9.10\build\Container.targets(198,5): error CTC1003: Visual Studio container tools require Docker to be running
When looking at the log prior to that error, I can see that VS is trying to run the docker image using the following command
docker run -dt -v "C:\Users\myusername\vsdbg\vs2017u5:/remote_debugger:rw" -v "C:\WinProjects\ProjectName\ProjectName:/app" -v "C:\WinProjects\ProjectName:/src" -v "C:\Users\myusername\AppData\Roaming\Microsoft\UserSecrets:/root/.microsoft/usersecrets:ro" -v "C:\Users\myusername\AppData\Roaming\ASP.NET\Https:/root/.aspnet/https:ro" -v "C:\Users\myusername\.nuget\packages\:/root/.nuget/fallbackpackages2" -v "C:\Program Files\dotnet\sdk\NuGetFallbackFolder:/root/.nuget/fallbackpackages" -e "DOTNET_USE_POLLING_FILE_WATCHER=1" -e "ASPNETCORE_ENVIRONMENT=Development" -e "ASPNETCORE_URLS=https://+:443;http://+:80" -e "NUGET_PACKAGES=/root/.nuget/fallbackpackages2" -e "NUGET_FALLBACK_PACKAGES=/root/.nuget/fallbackpackages;/root/.nuget/fallbackpackages2" -P --name ProjectName --entrypoint tail projectname:dev -f /dev/null
But that command throws the following error
docker: Error response from daemon: invalid volume specification: 'C:\Users\myusername\AppData\Roaming\ASP.NET\Https:/root/.aspnet/https:ro'.
How can I fix this issue and run a Docker image from Visual Studio 2019?
Using the Package Manager Console
in Visual Studio, The following command work with no issues.
docker ps
docker-machine status
I don't understand why Visual Studio is throwing error CTC1003: Visual Studio container tools require Docker to be running
I also executed ps kill
to all images found by running docker ps
. I also ran docker system prune -a
to clean up everything. but still the same issue.
Additionally, I added docker-compose
project to my solution. When it runs I get the following error
-------------------------------------------------------------------
You may only use the Microsoft .NET Core Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.
-------------------------------------------------------------------
It was not possible to find any installed .NET Core SDKs
Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
https://aka.ms/dotnet-download
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.
The program 'dotnet' has exited with code 145 (0x91).
Upvotes: 0
Views: 3046
Reputation: 11
Docker is a lightweight VM solution to deploy certain types of projects to for testing. It looks like you need to get Docker Desktop running on that machine before it will deploy/debug the Web API.
Once you have an instance of Docker running, you will be able to run/debug to that.
So the questions I would have are: 1) is this running on a physical machine or a VM? It makes a difference because you need to have Hyper V running in order use Docker on windows, and you can't (at least i haven't been able to) run Hyper V within a VM. 2)Have you downloaded and run the Docker Desktop install?
here's the link: https://hub.docker.com/?overlay=onboarding
NOTE: When you install Docker, make sure you select to use Linux containers, NOT windows... I haven't been able to get it to work with Windows containers selected.
When you created the project, it should have downloaded docker for install, but maybe something happened. Once its installed, it will run whenever you reboot, unless you tell it not to.
Erik
Upvotes: 1