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:

  • Error starting userland proxy: listen tcp0.0.0.0:3306: bind: address already in use
  • CoreOS member node will not start when using “etcdctl member add”
  • Cancelling ulimit bounds
  • Jboss 5.1 in Dockerfile - how to reach the server in a browser
  • Docker - Ok to delete data loop file?
  • Start node app when running docker container from cli
  • 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?

  • Viewing startup logs of docker
  • Docker interactive mode and executing script
  • Api command for tree structure of docker images
  • Can't install memcached package in PHP5.6-apache container
  • Docker - Couldn't connect to Docker daemon
  • Docker Build: mkdir creates folders, but they disappear in runtime
  • 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.