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:

  • How do I setup a read only private docker registry using just HTTP?
  • Docker push with artifactory
  • How to choose to which network doing port mapping
  • How to check if application has started inside container
  • Why I need a password to get access to the jupyter notebook when I use docker machine?
  • IPC communication between Docker containers
  • 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

    I have tried using Windows 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?

  • Docker networking on single host with compose
  • php docker link apache docker
  • How to develop Erlang Nitrogen apps in Docker
  • How to copy folders to docker image from Dockerfile?
  • Using a buildroot distro as a docker *host*
  • Where to find more explicit errors given container error status codes?
  • 2 Solutions collect form web for “Visual Studio Tools for Docker – PrepareForCompile task failed unexpectedly”

    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.

    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"

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.