Solve Docker for Windows error: A firewall is blocking file Sharing between Windows and the containers

For the quick answer jump to the conclusion.

Yesterday I was trying to mount a data volume in a Docker container and using Docker Community Edition for Windows (aka Docker CE for Windows) you first need to share your drives in the Docker settings:

ShareDrives

Unfortunately after clicking on “Apply” I got the following error:

A firewall is blocking file Sharing between Windows and the containers.

In the documentation link the explanation was quite clear, I needed to  allow connections to 10.0.75.1 port 445 (the Windows host) from 10.0.75.2 (the virtual machine).

Looking in my Windows firewall rules I saw the rule was already there:

Strange!

Then I tried to completely disable the Windows Firewall, but the result was still the same error. It didn’t helped.

After some reboots, Docker resets etc… and more than one hour troubleshooting I was finally able to find this blog post which helped me to solve the issue, which I will describe here:

  1. Go to the Network and Sharing Center:
  2. Win Button + X
  3. Click on “Network Connection”
  4.  A Settings window will be opened and scroll down in the Settings window
  5. Click on “Network and Sharing Center”:

  6. Click on the “VEthernet (DockerNAT)” adpater:

  7. Click on “Properties”:

  8. Uninstall “File and Printer Sharing for Microsoft Networks”:

  9. Install “File and Printer Sharing for Microsoft Networks” again:

  10. Click Close, now you should be able to Share your drives in the Docker Settings and mount those drives and folders as a data volume like:
    docker run -d -P --name web -v C:/temp:/webapp training/webapp python app.py

Conclusion

If you are getting the error and your firewall rules are OK, to solve this problem just uninstall and reinstall again the “File and Printer Sharing for Microsoft Networks” on the DockerNAT network interface.

36 thoughts on “Solve Docker for Windows error: A firewall is blocking file Sharing between Windows and the containers

Add yours

  1. Impossible to make it work, despite all kind posts up there. None of the solutions worked for me. It’s true that you cannot install file and print sharing from the GUI as Microsoft states but the command line solution does not work (it seems to me that it’s the same as unchecking the box in the GUI. So, for now, I have to live without data persistence which makes the use of dockers of now use to me.

    Like

  2. I found another way on another website
    Leave File and Printer Sharing for Microsoft Networks turned
    on.
    Type Powershell in the Search bar.
    Right-click on Windows PowerShell, and select
    Run as Administrator.
    Type netsh advfirewall firewall set rule group=”File and Printer Sharing” new enable=Yes, and hit
    Enter.
    Close PowerShell.
    credit : Karen Her
    https://www.windowsphoneinfo.com/threads/cannot-uninstall-file-and-printer-sharing-for-microsoft-windows.99158/

    Like

    1. Thanks but neither this nor any other tip here worked for me 😦 Still can’t share drive with my containers in Docker

      Like

  3. Thanks for your post. Interesting advice yet it did not work for me. Strangely (or maybe not) completely disabling the Firewall does not make it possible to Share drives and doing a Restart of Docker doesn’t help. Restarting the machine has no joy. Configuring the Firewall does not work either.

    I really don’t understand why such a common place feature of Virtual Machines and Hyper-Visors is so hard on Hyper-V? Well maybe I do; Hyper-V is after all a Microsoft product running on a Microsoft operating system so we should perhaps keep our expectations fairly low..

    Also the bit in the article about uninstalling “File and Printer Sharing for Microsoft Networks” is no longer possible on most Windows 10 machines. Microsoft has decided we are not allowed to do this any more. We can disable it yet this of course may not achieve the desired outcome.

    Like

    1. I’ve found this to be the case for me as well. I cannot uninstall the “File & Printer sharing” on my Win10, and disabling/reenabling does not make a difference for me.

      Like

  4. Just a reminder for people searching for a solution: Do you have a VPN connection up and running?
    I had the same issue, and search around on the internett for solution. Tried every solution found (including this one), but nothing worked. Firewall still blocking! Finally I realized my VPN Connection was up and running (blush!), and blocked the drive sharing in docker. After disconnecting VPN, the share just went fine. Then I could restart the VPN Connection, and startup my docker container (With mounted folder on shared disk).

    Liked by 3 people

  5. I had the same issue, and search around and tried every solution found. Suddenly I realized that my VPN Connection was up and running (BLUSH). So … just a remainder for you searching around :-).
    After disconnecting the sharing went just fine. Then I could reestatablish the VPN and fireup my docker container (Mount shared volume).

    Like

  6. Hi! Thanks for your post! I tried with your guide, deactivated the firewall and even reinstalled Docker taking the latest edge version 17.11.0-ce-win40 but nothing helped.. Do you have any other idea? Thanks a lot in advance!

    Like

  7. Hi! Thanks for your post! I tried with your guide, deactivated the firewall and even reinstalled Docker taking the latest edge version 17.11.0-ce-win40 but nothing helped.. Do you have any other idea? Thanks a lot in advance!

    Like

  8. The latest (Edge 17.06) version of Docker for Windows will attempt these steps automatically as a workaround.

    Like

  9. The latest (Edge 17.06) version of Docker for Windows will attempt these steps automatically as a workaround.

    Like

  10. I had the same problem. You don’t even need to uninstall and reinstall the ‘File and printer sharing for microsoft networks’. Just uncheck it, save by clicking ‘OK’, then open VEthernet (DockerNAT) – properties again and check it again. Worked for me!

    Like

  11. I had the same problem. You don’t even need to uninstall and reinstall the ‘File and printer sharing for microsoft networks’. Just uncheck it, save by clicking ‘OK’, then open VEthernet (DockerNAT) – properties again and check it again. Worked for me!

    Liked by 1 person

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Up ↑