commit 035bbe5185a6786fabc59efd3f8a4be30e3c1f35 Author: Fabio Date: Wed Jan 22 13:36:21 2025 +0100 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..0f1f68e --- /dev/null +++ b/README.md @@ -0,0 +1,123 @@ +# 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](https://forgit.patachina.duckdns.org/Fabio/wsdd-docker)) o scaricarlo da registry locale + +``` +sudo docker pull images.patachina.duckdns.org/wsdd +``` + +### Set up the SMB share +we’re going to use crazymax’s 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 +``` + +don’t forget to change ```$TIMEZONE``` to your local timezone, [list of tz time zones](https://en.wikipedia.org/wiki/List_of_tz_database_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, that’s 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-smb’s configuration options are in the project’s [GitHub repo](https://github.com/crazy-max/docker-samba) + +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 share’s name to be. + +```bash + 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: + +``` + + + + %h + + _smb._tcp + 445 + + +``` +save it and start the container + +```docker compose up -d``` + +You should now have Network discovery working on almost every OS! diff --git a/config.yml b/config.yml new file mode 100644 index 0000000..85eb5b1 --- /dev/null +++ b/config.yml @@ -0,0 +1,26 @@ +auth: + - user: root + group: root + uid: 0 + gid: 0 + password: bar + +global: + - "force user = root" + - "force group = root" + +share: + - name: PlexMediaFiles + path: /plexmediafiles + browsable: yes + readonly: no + guestok: yes + veto: no + recycle: yes + - name: HomeOrangePi + path: /home + browsable: yes + readonly: no + guestok: yes + veto: no + recycle: yes diff --git a/docker-compose.yalm b/docker-compose.yalm new file mode 100644 index 0000000..64a7e4b --- /dev/null +++ b/docker-compose.yalm @@ -0,0 +1,31 @@ +## https://fariszr.com/en/docker-smb-network-discovery/ +version: "3.5" + +services: + samba: + image: crazymax/samba + container_name: samba + network_mode: host + volumes: + - /home/orangepi/dockerfiles/smb:/data + - /home/nvme/plexmediafiles:/plexmediafiles + - /home/nvme/plexmediafiles/fabio:/sync + - /home/orangepi:/home + environment: + - "TZ=Europe/Rome" + - "SAMBA_LOG_LEVEL=0" + restart: unless-stopped + avahi: + image: ydkn/avahi + hostname: OrangePiSMB + network_mode: host + volumes: + - /home/orangepi/dockerfiles/avahi-services:/etc/avahi/services:ro + restart: unless-stopped + wsdd: +# image: jonasped/wsdd + image: wsdd:latest + network_mode: host + environment: + - 'HOSTNAME=OrangePiSMB' + restart: unless-stopped \ No newline at end of file diff --git a/smb.service b/smb.service new file mode 100644 index 0000000..5153dd2 --- /dev/null +++ b/smb.service @@ -0,0 +1,9 @@ + + + + %h + + _smb._tcp + 445 + +