I first created a running Windows 10 VM environment + licensed msoffice and stuff running in qemu-kvm on my Ubuntu 18.04 LTS system; powered by Thinkpad t460 tbh :proud:
then there was the problem… sharing files between the hosts.
I was thinking about networking + virtualization solutions to overcome this so I just found this very useful, interestingly documented, nice docker container; easy to configure and ready to use : dperson/samba
Thank you dperson, this is very useful!
Next step: Run this one liner docker run to have SMB protocol up and running on your environment, I will explain the command below :
$ sudo docker run -it --name samba -p 139:139 -p 445:445 -v /mnt:/share -d dperson/samba -w "USERS" -u "win;badpasswd" -s "users;/share;yes;no;yes;win;win;win;win"This above command will pull the image from the hub and run it with the following samba configuration for smbd.
/share mountpoint inside the docker container will bind mount onto /mnt on Ubuntu host and
make sure there’s a user named win privileged by badpasswd to make sure it can access and rw onto shared “users” directory. Make sure it’s running :
On my Windows10, I just had to add “Map Network Drive” just like in the screenshot attached below : \192.168.122.1\users is the smb:\ ip address which is actually running in my docker container hosted on my ubuntu physical host and the ip address is the virbr0 qemu-kvm nat networking bridge interface ip address (which I have win10 vm on the same network) and ta-da! It’s accessible as the driver name (Y in this case) and you can just copy any kind of files from the windows 10 virtual environment and you will be able to see and reach those files on your /mnt mountpoint on your ubuntu host by docker and networking power. I just find it delicious and smart.
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fe43d80f567a dperson/samba "/sbin/tini -- /usr/…" 24 minutes ago Up 24 minutes (healthy) 0.0.0.0:139->139/tcp, 137-138/udp, 0.0.0.0:445->445/tcp samba
TroubleshootingSome useful stuff to troubleshoot around
$ sudo docker inspect $ID $ sudo docker logs $ID
$ sudo smbclient -L localhost -Uwin -WUSERS WARNING: The "syslog" option is deprecated Enter USERS\win's password:To remove the docker container in case of any need :
Sharename Type Comment ---------
users Disk win
IPC$ IPC IPC Service (Samba Server)Reconnecting with SMB1 for workgroup listing.
$ sudo docker stop sambaI find myself suprised how come these 2 very different systems have started to work together very nice, delighted.
$ sudo docker rm samba
$ sudo docker volume prune (this will attempt to remove all unusued volumes by docker)
Hope you enjoy it!