6. Samba - nerdily/Raspberry-Pi-Docker-Swarm GitHub Wiki
Ensure the docker user has appropriate permissions into the share
sudo chown -R root:pi /mnt/glusterfs/fileshare
sudo chmod -R 775 /mnt/glusterfs/fileshare
-
sudo chmod g+s /mnt/glusterfs/fileshare
(Ensures all future content in the folder will inherit group ownership)
version: '3.9'
services:
samba:
image: dperson/samba
# container_name: samba #Docker Swarm doesn't use this value
healthcheck:
disable: true
deploy:
replicas: 1
restart_policy:
condition: on-failure
stdin_open: true
tty: true
environment:
TZ: America/New_York
# advertise shares, default: true, or false (open ports 137, 138)
NMBD: "true"
# add a single user. If you need more, use command instead of environment
# required arg: "<username>;<passwd>"
# <username> for user
# <password> for user
# [ID] for user, default: ""
# [group] for user, default: ""
USER: "pi;<password>"
# set the UID for the samba share, default: ""
USERID: "1000"
# set the GID for the samba share, default: ""
GROUPID: "1000"
# add a single share. If you need more, use command instead of environment
# required arg: "<name>;</path>"
# <share_name>;
# <path_to_share>;
# [browsable] default:'yes' or 'no';
# [read_only] default:'yes' or 'no';
# [guest]: default: 'yes' or 'no';
# [users]: default: 'all' or list of allowed users;
# [admins] default: 'none' or list of admin users;
# [writelist] default: 'none' or list of users that can write to read-only share;
# [comment] default: 'none' or description of share
SHARE: "Media;/mnt;yes;no;no;all;'pi';'pi';'Cluster Fileshare"
# workgroup/domain name for share default: "MYGROUP"
WORKGROUP: "WORKGROUP"
# if set, disables recycle bin for shares
RECYCLE: "false"
# if set, disables SMB2 minimum version
# SMB: ""
networks:
- default
ports:
- "137:137/udp" # required to advertise shares (NMBD)
- "138:138/udp" # required to advertise shares (NMBD)
- "139:139/tcp" # default smb port
- "445:445/tcp" # default smb port
read_only: false
tmpfs:
- /tmp
volumes:
- /mnt/glusterfs/fileshare:/mnt:z # :z allows share to be used by multiple containers
docker stack deploy --compose-file=/mnt/glusterfs/configs/samba/samba.yml samba
Follow this if you get access denied errors. It worked for me.