docker-samba icon indicating copy to clipboard operation
docker-samba copied to clipboard

Add ZeroConf Service Discovery

Open crazy-max opened this issue 3 years ago • 7 comments

As this image drops support for legacy protocols including NetBIOS, WINS, and Samba port 139 for security purposes, for Windows clients, Samba won't be shown under network browsing. We could use mDNS and DNS-SD with Samba using Avahi daemon for that but it only works on Linux and OSX machines afaik.

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
 <name replace-wildcards="yes">%h</name>
 <service>
   <type>_smb._tcp</type>
   <port>445</port>
 </service>
 <service>
   <type>_device-info._tcp</type>
   <port>0</port>
   <txt-record>model=RackMac</txt-record>
 </service>
 <service>
   <type>_adisk._tcp</type>
   <txt-record>sys=waMa=0,adVF=0x100</txt-record>
   <txt-record>dk0=adVN=TimeMachine,adVF=0x82</txt-record>
 </service>
</service-group>

crazy-max avatar May 30 '21 00:05 crazy-max

The Samba server automatic network discovery can be added with:

  • wsdd: Via Windows Explorer | Network.
  • avahi Linux (for example Ubuntu GNOME Nautilus | Other Locations.

wsdd and avahi don't have a relation to Samba. For example, the avahi configuration below can make a Samba server and SSH server available in Nautilus:

image

Windows Explorer:

Windows Explorer

Avahi smb.service

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
 <name replace-wildcards="yes">%h</name>
 <service>
   <type>_smb._tcp</type>
   <port>445</port>
 </service>
</service-group>

My proposal is to create two separate wsdd and avahi containers which can be launched via docker-compose.yml, for example in my forked dperson/samba: https://github.com/Erriez/docker-samba/blob/master/docker-compose.yml

Erriez avatar Dec 22 '21 19:12 Erriez

My proposal is to create two separate wsdd and avahi containers which can be launched via docker-compose.yml, for example in my forked dperson/samba: https://github.com/Erriez/docker-samba/blob/master/docker-compose.yml

Yes indeed, the idea is to have sidecar containers to handle that.

crazy-max avatar Dec 27 '21 02:12 crazy-max

Do you have a preference to choose an existing well-maintained and easy to configure wsdd and avahi image?

https://hub.docker.com/search?q=avahi&type=image https://hub.docker.com/search?q=wsdd&type=image

Erriez avatar Dec 27 '21 10:12 Erriez

I have added these two containers, which announces the host successfully in both worlds, Windows and *nix/OSX.

  wsdd:
    image: jonasped/wsdd
    container_name: wsdd
    network_mode: host
    restart: unless-stopped
  avahi:
    image: ydkn/avahi
    container_name: avahi
    network_mode: host
    volumes:
      - "./data/avahi/services:/etc/avahi/services"
    restart: unless-stopped

Should we add this as a seperate example docker-compose file? I'd be happy to open a pull request.

itrich avatar Apr 12 '22 10:04 itrich