This is a Samba 4 server docker image, aims at setting up a smb share without messing up your server. Pull the image, mount a shared folder and you are ready to go.
Required arguments:
Usage:
docker run -d --name samba --net=host -v /media/movies:/share -v /container_data/samba/config:/etc/samba yaurora/samba:latest
docker run -d --name samba -p 139:139 -p 445:445 -v /media/movies:/share -v /container_data/samba/config:/etc/samba yaurora/samba:latest
version: '3'
services:
samba:
image: yaurora/samba
container_name: samba
volumes:
- /container_data/samba/config:/etc/samba
- /container_data/media:/share
environment:
- TZ=Asia/Shanghai
- SMB_USER=someuser
- SMB_PASS=somePass
ports:
- 139:139
- 445:445
restart: always
Note that if you want to expose more than one share, you can costomize it in smb.conf, for instance, but make sure you added them to the volume binds. The docker-compose file will be something like below:
version: '3'
services:
samba:
image: yaurora/samba
container_name: samba
volumes:
- /container_data/samba/config:/etc/samba
- /some_folder/movies:/movies
- /another_folder/tvseries:/tvseries
environment:
- TZ=Asia/Shanghai
- SMB_USER=someuser
- SMB_PASS=somePass
ports:
- 139:139
- 445:445
restart: always
then the smb config will be something like below, just make sure the path in each share matches the volumes you exposed above:
[global]
map to guest = Bad User
log file = /var/log/samba/%m
log level = 10
workgroup = WORKGROUP
server role = standalone server
usershare allow guests = no
[movies]
comment = movies
path = /movies
read only = no
browsable = yes
[tvseries]
comment = tvseries
path = /tvseries
read only = no
browsable = yes
e.g., on Windows machine mount the share with Windows explorer or the "net use" command (Do NOT run the command elevated, e.g. as Administrator, otherwise you won't have access to the mapped drive since it was mappped under the administrator's account :)):
net use X: \\192.168.1.100\media smb_pass /user:smb_user /persistent:yes
or PowerShell if you like:
New-PSDrive -Name Y -PSProvider FileSystem -Root \\192.168.1.100\media -Description "Samba share on 192.168.1.100" -Scope global -Persist -Credential (Get-Credential)
At last, make sure you give correct permissions to the samba user you created on folders you exposed. If something went wrong with the access, you probably need to correct the permissions if necessary:
docker exec -it samba /bin/bash
chown -R SMB_USER: /share # replace SMB_USER with the username you created in your docker run commend, and replace the path with your own value
Source: https://github.com/yaurora/docker-samba
Content type
Image
Digest
Size
97.8 MB
Last updated
almost 5 years ago
docker pull yaurora/samba