Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Tools for Docker - PrepareForCompile task failed unexpectedly

I took a clean machine (Windows 10 Enterprise w/out the Anniversary Update) and installed (in this order) Full IIS, Hyper-V, VS2015 Enterprise, .NET Core 1.0.1 Tooling Preview 2, Docker for Windows, Visual Studio Docker Tools, and a few other random programs.

I then opened VS2015 and created a default .NET core website. When I run (F5) all works as expected. I then right clicked on the project and went to Add->Docker Support. Now when trying to run (F5) using Docker I see this error message:

MSB4018 The "PrepareForCompile" task failed unexpectedly. Microsoft.DotNet.Docker.CommandlineClientException: Error response from daemon: Container ... is not running at ...

I have searched online and the only thing I can find that might explain it is that I don't think Shared Drives are working. I did set it up in Docker->Shared Drives, but when I run: docker run --rm -v c:/Users:/data alpine ls /data the response is empty.

Likewise when I try using busy box the directory is empty.

docker run -it -v /C/Users:/wormhole busybox cd wormhole ls

I have tried using Windows Desktop for Docker 1.12.1-stable and beta 26. Both have the same issue.

Some have indicated that Antivirus could cause a problem. I do have Mcafee installed, but I cannot uninstall or disable the antivirus software.

Some have suggested that passwords with unusual characters can cause this issue but that does not apply here.

I don't know that shared drives are causing the VS2015 error, but it seems like a good place to start since shared drives are broken.

I have restarted bot hdock and the computer many times, to no avail.

Any Ideas?

like image 886
JALLRED Avatar asked Sep 20 '16 21:09

JALLRED


2 Answers

I had the same issue.

In order to fix it I found the container referenced by the id in the stack trace. Then I removed it:

docker rm <containerid>

When I tried running from VS 2015 again it worked. I don't know what initially caused the issue.

like image 103
Nikola Kramaric Avatar answered Oct 20 '22 21:10

Nikola Kramaric


I just wanted to add since I also stumbled upon this issue. I had a clean Win 10 machine, and I just had to enable the "Shared Drive" setting in docker:

This may not be the actual problem that you're facing (Thankfully you fixed it!); this is just for people that may not have this enabled!

Step 1: Right Click on Docker Icon in taskbar

Step 2: Click Settings

Step 3: Click Shared Drives. Select the Checkbox for your hard drive, and click "Apply"

like image 6
Jose A Avatar answered Oct 20 '22 22:10

Jose A