Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while sharing local drive(volume) with docker for windows

Tags:

docker

I am getting below error when I try to share local drive(volume) with docker for windows

docker run --rm -v c:/Users:/data alpine ls /data
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: C: drive is not shared. Please shar
e it in Docker for Windows Settings.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.

I tried sharing the folder from the docker settings and provided my username and password but no luck and getting same error

like image 769
Naga Sai A Avatar asked May 21 '17 17:05

Naga Sai A


3 Answers

I had a similar issue with the error message "docker: Error response from daemon: Drive sharing failed for an unknown reason."

I opened the docker settings > Shared Drives > checked on C drive > Click Apply and re-started docker to resolve the issue

windows docker settings

like image 119
Madhu Tomy Avatar answered Nov 19 '22 13:11

Madhu Tomy


I was facing a similar issue when starting containers with docker-compose. I got an error:

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

Then I checked settings for Docker and under Shared Drives section I tried to check the checkbox for C: drive, but after hitting apply checkbox unchecked itself.

Then I copied the line docker run --rm -v c:/Users:/data alpine ls /data into Powershell, ran it and got the error:

Drive sharing failed for an unknown reason.

But after this error, I decided to just try restarting Docker. After the restart, I tried to check the checkbox in the Shared Drives section once again and now it stayed checked and everything is working as it should.

I was using Docker Stable version.

like image 25
Kārlis Gustavs Logins Avatar answered Nov 19 '22 13:11

Kārlis Gustavs Logins


At the moment at Creators Update (1703) Samba shares are not working. There are a lot of tickets in official repo:

For example: #662, #669, #756

There is workaround described here:

The same started happening for me after installing the Win 10 Creators Update (Build 15063)

Firewall rules are not the issue, those are correct for some reason, after a reboot, I cannot access any local SMB shares on the DockerNAT interface (10.0.75.1)

I am able to fix this temporarily by disabling and & re-enabling the"File and Printer Sharing for Microsoft Networks" component on the virtual "DockerNAT" network interface. afterwards, I am able to browse \10.0.75.1 disable & re-enable the shared drive in Docker settings and it works - until next reboot

like image 2
Leandr Khaliullov Avatar answered Nov 19 '22 14:11

Leandr Khaliullov