Samba Docker image based on Alpine Linux and crazy-max docker-samba repository.
This container includes a web service discovery (wsdd, using smbd
) to make the server discoverable by all Windows PCs on the same workgroup. Also, can recover custom user settings and passwords from samba TDB files (Trivial DataBase).
Instead build from scratch this container, you can pull it from docker hub or download only the docker-compose.yml
and the config.yml
file on examples/compose/.
- Features
- Build locally
- Environment variables
- Volumes
- Ports
- Configuration
- Import custom user passwords and preferences
- Usage
- Notes
- Upgrade
- Contributing
- License
- Easy configuration through YAML
- Improve operability with Mac OS X clients
- This version mantains some support for legacy protocols including NetBIOS
- Backup and restore custom user passwords and settings
git clone https://github.com/Axia-SA/docker-samba.git
cd docker-samba
# Build image and output to docker (default)
docker buildx bake
# Build multi-platform image
docker buildx bake image-all
TZ
: Timezone assigned to the container (defaultUTC
)SAMBA_WORKGROUP
: NT-Domain-Name or Workgroup-Name. (defaultWORKGROUP
)SAMBA_SERVER_STRING
: Server string is the equivalent of the NT Description field. (defaultDocker Samba Server
)SAMBA_LOG_LEVEL
: Log level. (default0
)SAMBA_FOLLOW_SYMLINKS
: Allow to follow symlinks. (defaultyes
)SAMBA_WIDE_LINKS
: Controls whether or not links in the UNIX file system may be followed by the server. (defaultyes
)SAMBA_HOSTS_ALLOW
: Set of hosts which are permitted to access a service. (default127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
)SAMBA_INTERFACES
: Allows you to override the default network interfaces list.SAMBA_DISABLE_NETBIOS
: Disable NetBIOS for older connections. Values can beyes
orno
(default isyes
)
More info: https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html
/data
: Contains cache, configuration and runtime data
137/udp
: NetBIOS Name Service138/udp
: NetBIOS Datagram139/tcp
: NetBIOS Session445/tcp
: Samba Server over TCP
More info: https://wiki.samba.org/index.php/Samba_NT4_PDC_Port_Usage
Before using this image you have to create the YAML configuration file /data/config.yml
to be able to create users,
provide global options and add shares. Here is an example:
auth:
- user: foo
uid: 1000
gid: 1000
password: bar
- user: baz
uid: 1100
gid: 1200
password_file: /run/secrets/baz_password
global:
- "force user = foo"
- "force group = foo"
share:
- name: foo
path: /samba/foo
browsable: yes
readonly: no
guestok: no
validusers: foo
writelist: foo
veto: no
veto: no
is a list of predefined files and directories that will not be
visible or accessible:
/._*/.apdisk/.AppleDouble/.DS_Store/.TemporaryItems/.Trashes/desktop.ini/ehthumbs.db/Network Trash Folder/Temporary Items/Thumbs.db/
More info: https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html#VETOFILES
A more complete example is available here.
You can also use an existing TDB files to import previous custom settings like encrypted passwords that can not be stored on files under the password_file
parameter on config.yml
.
To achieve this, put the passdb.tdb
and secrets.tdb
files (or any *.tdb
files) on config/
. This files will be imported while the container is being building.
Notice: TDB files must be consistent with
config.yml
file to work properly
Docker compose is the recommended way to run this image. Copy the content of folder examples/compose
in /var/samba/
on your host for example. Edit the compose and configuration files with your preferences and run the
following commands:
docker-compose up -d
docker-compose logs -f
You can also use the following minimal command:
docker run -d --network host \
-v "$(pwd)/data:/data" \
--name samba cbottazzi/docker-samba
Recreate the container when exists an update:
docker-compose pull
docker-compose up -d
Use the following commands to check the logs and status:
docker-compose logs samba
docker-compose exec samba smbstatus
MIT. See LICENSE
for more details.