mirror of
https://github.com/plazotronik/smb.git
synced 2026-09-19 15:20:53 +03:00
1
Using Docker Compose
Vladimir Eroshenko edited this page 2025-07-24 19:45:26 +03:00
Table of Contents
Sample docker-compose.yml
services:
samba:
image: plazotronik/smb
container_name: samba
container_name: samba
hostname: samba
security_opt:
- no-new-privileges=true
restart: unless-stopped
stdin_open: true
tty: true
environment:
# timszone, ex: 'Europe/Moscow'
TZ: "Europe/Moscow"
# 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: "myuser;mypassword"
# set the UID for the samba share, default: ""
USERID: "0"
# set the GID for the samba share, default: ""
GROUPID: "0"
# 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: "mysharename;/mnt;yes;no;no;myuser;'none';'none';'my awesome share"
# workgroup/domain name for share default: "MYGROUP"
WORKGROUP: "WORKGROUP"
# if set, disables recycle bin for shares
RECYCLE: ""
# if set, disables SMB2 minimum version
# SMB: ""
networks:
- samba
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
- /run
volumes:
- /mnt:/mnt:z # :z allows share to be used by multiple containers
networks:
samba:
name: samba
driver_opts:
com.docker.network.bridge.name: br-samba
Specifying multiple users and/or shares
If you wish to define multiple users and/or multiple shares, use the command statement. Note, you should only provide one command statement.
Correct example:
command: '-u "myuser;mypassword" -s "ShareName;/path/in/container;yes;no;no;myuser"'
Incorrect:
command:
- '-u "myuser;mypassword"`
- '-s "ShareName;/path/in/container;yes;no;no;myuser"'