112

I've ran into an issue with Docker Desktop, currently im running the edge version as a user on Stackoverflow. Before I got the drive not shared for unknown reason error which was "solved" by installing edge version: Docker for Windows: Drive sharing failed for an unknown reason

Now that this was installed im getting this new error which prevents some containers from being built. These containers have all been tested and works on several other systems. Currently 3 out of 4 containers are not built and they all produce the same error as below:

ERROR: for db  Cannot create container for service db: status code not OK but 500: {"Message":"Unhandled exception: Filesharing has been cancelled"}
Encountered errors while bringing up the project.

full error:

Creating imt2291-part2_www_1 ...
Creating imt2291-part2_phpmyadmin_1 ... done
Creating imt2291-part2_db_1         ...
Creating imt2291-part2_test_1       ... error
Creating imt2291-part2_www_1        ... error
ERROR: for imt2291-part2_test_1  Cannot create container for service test: status code not OK but 500: {"Message":"Unhandled exception: Filesharing has been cancelled"}

ERROR: for imt2291-part2_www_1  Cannot create container for service www: status Creating imt2291-part2_db_1         ... error
lled"}

ERROR: for imt2291-part2_db_1  Cannot create container for service db: status code not OK but 500: {"Message":"Unhandled exception: Filesharing has been cancelled"}

ERROR: for test  Cannot create container for service test: status code not OK but 500: {"Message":"Unhandled exception: Filesharing has been cancelled"}

ERROR: for www  Cannot create container for service www: status code not OK but 500: {"Message":"Unhandled exception: Filesharing has been cancelled"}

ERROR: for db  Cannot create container for service db: status code not OK but 500: {"Message":"Unhandled exception: Filesharing has been cancelled"}
Encountered errors while bringing up the project.

Has anyone encountered this issue before and found a fix?

infroz
  • 1,152
  • 2
  • 6
  • 13

5 Answers5

213

You need to update File Sharing configuration in your Docker for Windows app (there is a new security hardening in 2.2.0.0 which has agressive defaults). Add all folders you need and then restart Docker for Windows.

example

Oleg Nenashev
  • 2,271
  • 1
  • 14
  • 4
  • Yes, using RDC or VNC. The settings are stored on disk @ C:\Users\\AppData\Roaming\Docker\settings.xml - so you *might* be able to alter them via filesharing if you are careful, but you'd probably still need to restart Docker Windows. – antonyh May 22 '20 at 15:30
  • 1
    I'm also beginner in Docker with the same issue. In my case It is sample ASP.NET MVC Core application provided by template from Microsoft. I do not know which folders need sharing. I've forced application running by adding c:\ and d:\ . After some trials I've found that project folder needs sharing and c:\users\. I was not able to narrow this further because there are plenty folders and obvious c:\users\\.docker is not enough. – robsosno Jun 04 '20 at 06:22
  • Didn't work on a network drive - copied to local drive and it worked – Yoav R. Dec 29 '20 at 12:47
62

After changing "File Sharing" to C Drive its start working in my windows machine. I am using docker desktop 2.3.0.3

enter image description here

Rejoanul Alam
  • 5,435
  • 3
  • 39
  • 68
  • 8
    Binding the exact directory somehow did not work for, however, mounting the entire C:\ drive worked. Weird. – Sanidhya Singh Jul 15 '20 at 09:47
  • Adding the project directory did the trick for me – Khuram Niaz Dec 20 '20 at 20:30
  • I'm assuming this is insecure, but it did resolve the issue for me. This hardening of docker which requires allowing my entire C:\ drive to be bound for file sharing seems spooky. Does anyone know how to avoid doing this? – Veridian Dynamics Jan 12 '21 at 18:51
  • 3
    Rajoanula Alam, you don't need to add the whole C folder to shared folders, you just need to add the parent project containing the Dockerfile to the share files. You can add many folders but clicking on the + button. – velocity Jan 14 '21 at 21:38
  • 1
    Tried sharing specific folder without any spaces in path (in case that might also be the problem) and it didn't work. Only adding C:\ worked. – Andrei Sinitson Oct 01 '21 at 12:18
3

I am using Docker in Windows 10 and had the same problem.
The solution suggested by Oleg Nenashev and Rejoanul Alam helped me.
Adding the project dir where the Dockerfile lives or C:/ to docker shared folders solves the problem.

Step 6 from Getting started states:

Shared folders, volumes, and bind mounts
If your project is outside of the Users directory (cd ~), then you need to share the drive or location of the Dockerfile and volume you are using.
If you get runtime errors indicating an application file is not found, a volume mount is denied, or a service cannot start, try enabling file or drive sharing.
Volume mounting requires shared drives for projects that live outside of C:\Users (Windows) or /Users (Mac), and is required for any project on Docker Desktop for Windows that uses Linux containers.
For more information, see File sharing on Docker for Mac, and the general examples on how to Manage data in containers.
If you are using Oracle VirtualBox on an older Windows OS, you might encounter an issue with shared folders as described in this VB trouble ticket. Newer Windows systems meet the requirements for Docker Desktop for Windows and do not need VirtualBox.

velocity
  • 1,630
  • 21
  • 24
1

I have meet this problem and my environment is windows. first when the issue happen, I chance the file sharing path to C: , and my project path is in G: ,so the command docker-compose up fail,and the massage is: docker: Error response from daemon: status code not OK but 500 {"Message":"Unhandled exception: Filesharing has been cancelled"}

I think the file sharing must include your project path. because when I set my file sharing path in other file path , it doesn't work, however, i chance it to the path where is my project path, docker-compose up do successfully!

dejanualex
  • 3,872
  • 6
  • 22
  • 37
catpanda
  • 11
  • 1
  • after do the thing upon ,i chance to file sharing to C: from my project path G: ,then, restart,and enter docker-compose down,docker-compose up by order , the command also work successfully! – catpanda Nov 27 '20 at 06:58
0

I had the same error and answers of Oleg Nenashev and Rejoanul Alam helped me to solve this error.

My task was to share volumes between containers.

I have a website folder with file index.html inside: enter image description here

Open Docker Desktop Settings and write the address of the folder you are working with in File Sharing:enter image description here

After this open this folder in your command prompt and add the necessary Docker command: enter image description here

If the command is correct and you did all steps attentively it must be working fine.

Johnny155
  • 51
  • 6