Delta Omega
Delta Omega

Reputation: 57

Docker fails in Visual Studio 2017, how do i get docker to run in VS2017

I have installed Docker and turned on Virtualization in the system bios. When I go to build a docker container of my .NET Core proj, it fails with this error:

"The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running."

Full error here with some JSON filter issue as well:

Error MSB4018 The "PrepareForBuild" task failed unexpectedly. Microsoft.DotNet.Docker.CommandLineClientException: error during connect: Get htp://%2F%2F.%2Fpipe%2Fdocker_engine/v1.27/containers/json?filters=%7B%22name%22%3A%7B%22dockercompose512535401_webapplication1_%22%3Atrue%7D%2C%22status%22%3A%7B%22running%22%3Atrue%7D%7D&limit=1: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running..

For more troubleshooting information, go to http://aka.ms/DockerToolsTroubleshooting ---> Microsoft.DotNet.Docker.CommandLineClientException: error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.27/containers/json?filters=%7B%22name%22%3A%7B%22dockercompose512535401_webapplication1_%22%3Atrue%7D%2C%22status%22%3A%7B%22running%22%3Atrue%7D%7D&limit=1: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running. at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.DotNet.Docker.DockerClient.d__0.MoveNext() --- End of inner exception stack trace --- at Microsoft.DotNet.Docker.DockerClient.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.DotNet.Docker.DockerWorkspace.d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.DotNet.Docker.BuildTasks.DockerBaseTask.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() docker-compose C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets 153

Upvotes: 2

Views: 5765

Answers (3)

denath
denath

Reputation: 9

I had the same problem using VS2017 and Windows 7, while trying to debug and run applications from VS2017. The problem seems to be that VS can to access the environmental variables needed by docker. The solution that worked for me was to execute from a CMD or PS the command docker-machine env default and then set these values as environmental values at Windows as shown in the following image

Windows Add Environmental Variables

Upvotes: 0

Paul
Paul

Reputation: 1825

I had this same issue, removing the edge version of docker and installing the stable version resolved it for me.

Upvotes: 1

WillemdeKok
WillemdeKok

Reputation: 328

This looks like you have used Docker Toolbox, Toolbox requires an additional step to work properly. You should try running this:

(assuming the default machine exists)

docker-machine env default

At the end of that command there will be a note of a command that you have to run depending on the shell environment. For cmd it will look like @for ... And for powershell it will look like an invoke-expression ...

Make sure you run that command, this is very important! Then test the Docker daemon using this:

docker info

As a side note those warning about the keyring are not really important, this is just because you are running on Windows and it will have no negative effect.

Hope this helps!

Upvotes: 4

Related Questions