No description
Find a file
2025-01-22 13:36:21 +01:00
config.yml first commit 2025-01-22 13:36:21 +01:00
docker-compose.yalm first commit 2025-01-22 13:36:21 +01:00
README.md first commit 2025-01-22 13:36:21 +01:00
smb.service first commit 2025-01-22 13:36:21 +01:00

Samba share with network discovery using docker-compose

docker-compose.yalm completo

i files completi scaricabili dal git, il docker-compose utilizzabile anche su Portainer

Per l'immagine wsdd fare il build (vedi git wsdd-docker) o scaricarlo da registry locale

sudo docker pull images.patachina.duckdns.org/wsdd

Set up the SMB share

were going to use crazymaxs smb container, pretty easy to setup and docker native. its recommended to use host networking for it.

docker-compose.yml

## https://fariszr.com/en/docker-smb-network-discovery/
version: "3.5"

services:
  samba:
    image: crazymax/samba
    container_name: samba
    network_mode: host
    volumes:
      - ./smb:/data
      - ./downloads:/downloads
    environment:
      - "TZ=$TIMEZONE"
      - "SAMBA_LOG_LEVEL=0"
    restart: always

dont forget to change $TIMEZONE to your local timezone, list of tz time zones

Configuration

Unlike normal SMBd, the container uses YAML for configuration.

auth:
  - user: root
    group: root
    uid: 0
    gid: 0
    password: bar

global:
  - "force user = root"
  - "force group = root"

share:
  - name: downloads
    path: /downloads
    browsable: yes
    readonly: no
    guestok: yes
    veto: no
    recycle: yes 

Here is a basic config for an open local share. All my files are owned by root, thats why i need to force root as the default user.

Put the config in the mounted data folder, so in the case of compose file above, its ./smb/config.yml

You can add more shares or more users and far more in the config. More details about docker-smbs configuration options are in the projects GitHub repo

After this you should be able to use the SMB share, though not discoverable.

WSDD, SMB network discovery for Windows

Add this to the docker-compose.yml file

  wsdd:
    image: wsdd
    network_mode: host
    environment:
      - 'HOSTNAME=$HOSTNAME'
    restart: always

just replace $HOSTNAME with your hostname and then start the container

docker compose up -d

Now you should see the share with the $HOSTNAME as its name in the network tab (if local device discovery is enabled) in Windows file explorer.

Avahi, SMB network discovery for MacOS and Linux

Add this to docker-compose.yml, make sure to change $HOSTNAME to whatever you want the shares name to be.

  avahi:
    image: ydkn/avahi
    hostname: $HOSTNAME
    network_mode: host
    volumes:
      - ./avahi-services:/etc/avahi/services:ro
    restart: always

avahi-services/smb.service create the file smb.service with the following content:

<?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>

save it and start the container

docker compose up -d

You should now have Network discovery working on almost every OS!