Using samba to share Linux container volumes with Windows hosts

Hi,
I’m trying to follow the instructions in https://www.yoctoproject.org/docs/2.7/dev-manual/dev-manual.html#setting-up-to-use-crops to setup a development image on my Windows 10 system using the latest Docker Desktop version 2.0.0.3 Engine 18.09.2. The instructions at https://github.com/crops/docker-win-mac-docs/wiki/Windows-Instructions-(Docker-Toolbox) are referencing the older docker toolbox. I’ve found they don’t work with Docker Desktop.

Specifically, when I try to start the samba container used to share the working directory using these steps:

Blockquote
docker volume create --name myvolume
docker run -it --rm -v myvolume:/workdir busybox chown -R 1000:1000 /workdir
docker create -t -p 445:445 --name samba -v myvolume:/workdir crops/samba
docker start samba

I get an error message

Blockquote
PS C:\WINDOWS\system32> docker start samba
Error response from daemon: driver failed programming external connectivity on endpoint samba (84c73bbaeff98db4708de528cac49e69257e56a9b3e8524c5840815bbe99aa47): Error starting userland proxy: Bind for 0.0.0.0:445: unexpected error Permission denied

There’s a post about this here which identifies the issue but does not suggest a workaround. It appears Docker Desktop is using port 445 for its DockerSmbMount and default MobyLinuxVM. There’s a brief mention of port 445 in the docker for windows guide referencing Shared Drives. I have no shared drives defined, however I do see shared drives at \10.0.75.1.

Is there a workaround for this? What is the recommended solution for allowing access to Linux volumes from my Windows host while the Linux image is running?

Thanks!
Dan

Hi Dan,

I am following the same walk through the instructions given in yocto manuals experiencing the same problems as you have pointed. I was nevertheless able to go a little bit further to get samba container starting. The error I get when starting SMB container is not exactly the same as yours but I guess it is in close connection with it,

Error response from daemon: driver failed programming external connectivity on endpoint samba (1af329bb593fde5634afac49b7f98805309feddcce76f156b711c15fdecbf590): Error starting userland proxy: listen tcp 0.0.0.0:445: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.

netstat -aon | more in cmd prompt tells me a bit more about this error: windows 10 host is already listening to port 445 through PID 4 and there should be only one listener at the same time.

  Protocol  Local Address   Remote Address   State      PID
  TCP       0.0.0.0:445     0.0.0.0:0        LISTENING    4

Looking for the PID in taskmgr confirms it is System.exe process but does not tell very much about it. So I tried to desactivate SMB support in the host. Googling a bit, I have found a good piece of info about Windows file sharing.

http://windowssysadmins.blogspot.com/2013/12/cifs-cifs-is-common-internet-files.html

that LanmanServer win10 also labelled Server service was delivering SMB support. I opened Windows Management Console and Services, stopped it, and picked disactivated as restart state. I then rebooted my host. The 445 port was no more listened to by the system as easily checked with netstat. I then recreated the SMB container and started it without pain,

PS C:\Users\Pimdocker> docker volume create --name yocto                                                                  yocto
PS C:\Users\Pimdocker> docker run -it --rm -v yocto:/workdir busybox chown -R 1000:1000 /workdir
Unable to find image 'busybox:latest' locally
latest: Pulling from library/busybox
7c9d20b9b6cd: Pull complete
Digest: sha256: ....
Status: Downloaded newer image for busybox:latest                                                                                                                                                                                               

PS C:\Users\Pimdocker> docker create -t -p 445:445 --name samba -v yocto:/workdir crops/samba 
Unable to find image 'crops/samba:latest' locally
latest: Pulling from crops/samba
16c48d79e9cc: Pull complete
3c654ad3ed7d: Pull complete
6276f4f9c29d: Pull complete 
a4bd43ad48ce: Pull complete
c07761be2ffe: Pull complete
a50c4dd30dc6: Pull complete
fe2f0ac8ed80: Pull complete
sha256: ...
Status: Downloaded newer image for crops/samba:latest
65d9cda5c5da0d5e531f855dc92f2600bb2156e253e27bf09149bb6ab1b9fc43                                                                                                                                                                                

PS C:\Users\Pimdocker> docker start samba 
samba

PS C:\Users\Pimdocker> docker ps -a  
CONTAINER ID  IMAGE COMMAND  CREATED  STATUS  PORTS  NAMES
65d9cda5c5da   crops/samba "samba.sh"  31 s ago  Up 20 seconds  0.0.0.0:445->445/tcp samba

C:\Users\Pimdocker>netstat -aon | find "445"
  TCP    0.0.0.0:445   0.0.0.0:0   LISTENING       7080
  TCP    [::]:445      [::]:0      LISTENING       7080

A stable process 7080 has been spawned listening to 445 port and this process is named com.docker.backend.exe according to taskmgr. I can not test it on a VM created with Hyper-Virtualization enabled since I can not have this machine and DockerVM up at the same time (due to RAM limitation (4GB for me in total)). I don’t know if SMB host servicing should be restarted after starting samba container. Could you tell me if this is working for you ?

Cheers,

Pierre