Up-to-date Samba Docker image optimized for NAS file sharing with full macOS Spotlight support.
1.8K
Up-to-date Samba Docker image optimized for NAS file sharing with full macOS Spotlight support via Elasticsearch integration.
See deploy-example for an example docker-compose.yml and smb.conf setup. Docker Compose is recommended for deployment. Note that you'll need to mount a number of files/directories into the container, in addition to the Samba shares themselves:
- /etc/passwd:/etc/passwd:ro
- /etc/shadow:/etc/shadow:ro
- /etc/group:/etc/group:ro
- ./10-tz.sh:/etc/cont-init.d/10-tz.sh:ro # set timezone
- ./70-smbusers.sh:/etc/cont-init.d/70-smbusers.sh:ro # set up SMB users
- ./smb.conf:/usr/local/samba/etc/smb.conf:ro # your smb.conf
- /var/log/samba-docker:/usr/local/samba/var/log # optional: Samba logs
The recommended usage is to remove Samba from the host and allow this container to bind directly to port 445 using host networking.
testparmWith your docker-compose.yml set up, you can use testparm as follows to check your smb.conf:
docker compose run samba testparm /usr/local/samba/etc/smb.conf
Samba is arguably the most important thing running on my NAS; when I'm browsing files/folders on it, I want it to be as fast as possible. To help achieve this I've added the following to the samba service in my docker-compose file:
command:
- ionice
- -c1
- -n1
- nice
- -n-17
- /usr/local/samba/sbin/smbd
- --foreground
- --no-process-group
- --configfile
- /usr/local/samba/etc/smb.conf
cap_add:
- CAP_SYS_NICE
This runs smbd in the "realtime" IO class, with priority 1 (the possible priorities are 0-7, with lower numbers being higher priority). To give it priority on the CPU, I also give smbd a nice value of -17 (values range down to -19, the highest priority).
This is necessary if you want the Samba container to use host networking and listen on port 445 (recommended).
apt remove smbclient samba samba-common && apt autoremove
smb.conf referencesmbd referencesmbpasswd referenceTo enable macOS Spotlight support, you'll need to set up an Elasticsearch instance and FSCrawler to index your Samba shares. See the deploy-example/elasticsearch directory for an example docker-compose.yml and configuration files, and deploy-example/fscrawler for an example FSCrawler setup.
Note that:
The example stack in deploy-example handles all of this (except the Tailscale bits). For additional guidance and troubleshooting, see my blog post on the topic. (LINK TK)
TK
Original works in this repo are licensed under GPL3; see LICENSE in this repo.
Content type
Image
Digest
sha256:eb7431e54…
Size
1.3 GB
Last updated
12 months ago
docker pull cdzombak/samba-docker