Docker Compose failed to build - Filesharing has been cancelled

53,271

Solution 1

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

Solution 2

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

Solution 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.

Solution 4

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!

Share:
53,271

Related videos on Youtube

infroz
Author by

infroz

Updated on July 08, 2022

Comments

  • infroz
    infroz almost 2 years

    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
      infroz about 4 years
      Docker version 2.2.2.0 (43066) edge Engine 19.03.5 Compose 1.25.4 Windows 10
  • antonyh
    antonyh almost 4 years
    Yes, using RDC or VNC. The settings are stored on disk @ C:\Users\<username>\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.
  • robsosno
    robsosno almost 4 years
    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\<my user>. I was not able to narrow this further because there are plenty folders and obvious c:\users\<my user>\.docker is not enough.
  • Sanidhya Singh
    Sanidhya Singh almost 4 years
    Binding the exact directory somehow did not work for, however, mounting the entire C:\ drive worked. Weird.
  • catpanda
    catpanda over 3 years
    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!
  • Khuram Niaz
    Khuram Niaz over 3 years
    Adding the project directory did the trick for me
  • Yoav R.
    Yoav R. over 3 years
    Didn't work on a network drive - copied to local drive and it worked
  • Veridian Dynamics
    Veridian Dynamics over 3 years
    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?
  • velocity
    velocity over 3 years
    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.
  • Andrei Sinitson
    Andrei Sinitson over 2 years
    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.