Docker toolbox with Visual studio - Volume sharing

2019-07-29 04:57发布

问题:

I'm trying to get running a docker support with Visual studio 2017 for a .net core 2.0 web app running on linux containers. I'm working on machine with win 7 OS, so I must use a Docker toolbox with Virtual box. I've already checked this question: How to get docker toolbox to work with .net core 2.0 project, but I got stuck in the following problem, when trying to run it with VS:

Volume sharing is not enabled. Enable volume sharing in the docker ce for windows settings

So far I know that there is a default volume mounted under the C:\Users, so my project files should be copied somewhere under this folder in case I don't want to mount any other volume. So I copied them there.

When I check the settings of my Virtual box, folder seems to be shared:

I can even cd into this folder with command line, but still can't get over this problem. Any ideas about this?

回答1:

Finally I got this running. Error message comming from VS is very misleading and it has nothing to do with volume sharing. Eventually I realized that problem is in running a debugger, because when I ran solution with ctrl + F5 everything was ok and container started correctly. Problem occurred only when running with F5 and trying to attach a debugger.

Then I found some clues in console output. VS tries to download some tooling for debugging containers with powershell script named GetVsDbg.ps1. When running this script I could observe errors like:

Add-Type : Cannot add type. The assembly 'System.IO.Compression.FileSystem' could not be found.

Finally I fixed this issue by updating powershell version which was somehow in collision with my .net framework installed on my machine. Here is the link:

https://www.microsoft.com/en-us/download/details.aspx?id=40855



回答2:

Below setting helped me getting rid of this error. Check the drive you want to share and click apply. This might ask you your network credential just enter in case it pops up.

Docker settings

Thanks, Rakesh



回答3:

Well in my case it turned out that I had changed my windows password and docker wasn't able to get access. So it was just

  1. uncheck shared drives
  2. Apply
  3. Check again. Enter new password
  4. restart docker