🌐
Pi My Life Up
pimylifeup.com › home › setting up a samba share using docker
Setting up a Samba Share using Docker - Pi My Life Up
October 7, 2024 - In this tutorial, we will show you how to easily set up a Samba share using a handy Docker container. Samba is a popular protocol for sharing files or folders from one device to another over a network.
🌐
Docker Hub
hub.docker.com › r › dperson › samba
dperson/samba - Docker Image
sudo docker run -it -p 139:139 -p 445:445 -d dperson/samba -p \ -u "example1;badpass" \ -u "example2;badpass" \ -s "public;/share" \ -s "users;/srv;no;no;no;example1,example2" \ -s "example1 private share;/example1;no;no;no;example1" \ -s "example2 private share;/example2;no;no;no;example2" Copy
Discussions

linux - Mount SMB/CIFS share within a Docker container - Stack Overflow
You could use the smbclient command (part of the Samba package) to access the SMB/CIFS server from within the Docker container without mounting it, in the same way that you might use curl to download or upload a file. There is a question on StackExchange Unix that deals with this, but in short: smbclient //server/share ... More on stackoverflow.com
🌐 stackoverflow.com
Accessing a networked samba share.
I use SMB shares in my docker containers all the time. I simply mount the share on the filesystem at some point, then put that volume into the docker-compose file. For example I have tv and movie shares on my synology which are used in my sonarr/radarr docker containers. /etc/fstab entries //192.168.1.50/tv /media/tv/ cifs vers=3.0,credentials=/home/user/new,uid=user,gid=user0 0 //192.168.1.50/movies /media/movies/ cifs vers=3.0,credentials=/home/user/new,uid=user,gid=user0 0 In the container, I just link the mount point to a volume and use the directory in the containered application. Docker-compose entry volumes: - /media/tv:/media/tv More on reddit.com
🌐 r/docker
5
3
January 1, 2022
How to see a local SMB share within containers.
I just mount stuff on the host and then map it into the container.... It is super easy. I am sure there are better ways of doing it but its the most convenient for me More on reddit.com
🌐 r/docker
10
5
August 24, 2018
Samba server - docker or native?
I'm going against the majority here and recommend using it via docker. This image is awesome: https://hub.docker.com/r/servercontainers/samba It's super easy to set up, easier than native if you already have a working compose file. It comes with sane defaults so you only have to worry about the shares themselves. It allows for ro mounting directories in the container, giving another layer of safety. And it makes it so that you can manage your samba shares where you manage everything else you serve, right there in that convenient docker compose file. I think that's the key word here: Convenience. Either docker or native will do just fine, but I find docker more convenient. More on reddit.com
🌐 r/selfhosted
42
29
February 27, 2022
🌐
GitHub
github.com › dockur › samba
GitHub - dockur/samba: Samba SMB server in a Docker container. · GitHub
docker run -it --rm --name samba -p 445:445 -e "NAME=Data" -e "USER=samba" -e "PASS=secret" -v "${PWD:-.}/samba:/storage" docker.io/dockurr/samba · To change the location of the shared folder, include the following bind mount in your compose file:
Starred by 758 users
Forked by 61 users
Languages   Shell 92.9% | Dockerfile 7.1%
🌐
The New Stack
thenewstack.io › home › create a samba share and use from in a docker container
Create a Samba Share and Use From in a Docker Container - The New Stack
March 14, 2025 - Install and configure Samba on an Ubuntu server. Create a persistent Docker volume mapped to a shared directory. Deploy an NGINX container using the Docker volume. Test the setup and verify that files are served correctly from the Samba share.
🌐
Docker Hub
hub.docker.com › r › bmst › samba-share
bmst/samba-share - Docker Image
# Make a volume container (only need to do this once) docker run -v /data --name my-data busybox true # Share it using Samba (Windows file sharing) docker run bmst/samba-share my-data | sh Copy
🌐
GitHub
github.com › fschuindt › docker-smb
GitHub - fschuindt/docker-smb: A containerized Samba server to share Docker host directories. · GitHub
A containerized Samba server to share Docker host directories. - fschuindt/docker-smb
Starred by 60 users
Forked by 34 users
Languages   Dockerfile
🌐
FreeKB
freekb.net › Article
Install Samba on Docker (smb)
docker run --detach --publish 139:139 --publish 445:445 --volume /usr/local/docker/samba:/etc/samba --volume /usr/local/docker/samba/share:/usr/local/share --restart unless-stopped --name samba dperson/samba · If using the --volume option, here is a starter smb.conf file.
🌐
GitHub
github.com › arthurpicht › docker-samba
GitHub - arthurpicht/docker-samba: Samba file sharing service as a docker image
docker run \ -d \ --rm \ --name samba \ -e ACCOUNT_smbuser=geheim \ -e UID_ACCOUNT_smbuser=1001 \ -e SAMBA_VOLUME_CONFIG_TEST="[test]; path=/shares/test; guest ok = no; read only = no; browsable = yes" \ --mount type=bind,source=/on/host/samba,target=/shares/test \ -p 139:139 \ -p 445:445 \ arthurpicht/samba · Target folder on host /on/host/samba needs file permissions for User-Id 1001 specified by UID_ACCOUNT_smbuser.
Author   arthurpicht
Find elsewhere
🌐
Docker Hub
hub.docker.com › r › elswork › samba
elswork/samba - Docker Image
docker run -d -p 139:139 -p 445:445 \ -- hostname any-host-name \ # Optional -e TZ=Europe/Madrid \ # Optional -v /any/path:/share/data \ # Replace /any/path with some path in your system owned by a real user from your host filesystem elswork/samba \ -u "1000:1000:alice:alice:put-any-password-here" \ # At least the first user must match (password can be different) with a real user from your host filesystem -u "1001:1001:bob:bob:secret" \ -u "1002:1002:guest:guest:guest" \ -s "Backup directory:/share/backups:rw:alice,bob" \ -s "Alice (private):/share/data/alice:rw:alice" \ -s "Bob (private):/share/data/bob:rw:bob" \ -s "Documents (readonly):/share/data/documents:ro:guest,alice,bob" Copy
🌐
FarisZR
fariszr.com › docker-smb-network-discovery
setup a Samba share with network discovery using docker-compose
December 31, 2022 - Add this to docker-compose.yml, make sure to change $HOSTNAME to whatever you want the share’s name to be. create the file smb.service with the following content: save it and start the container · You should now have Network discovery working on almost every OS! https://github.com/crazy-max/docker-samba/issues/1 ·
🌐
Mbirth
blog.mbirth.uk › 2024 › 09 › 28 › easy-file-sharing-via-docker.html
Easy file sharing via Docker – blog.mbirth.uk
September 28, 2024 - server: image: ghcr.io/serverc..._SERVER_STRING: Docker Host Samba #SAMBA_CONF_LOG_LEVEL: 3 ACCOUNT_username: password UID_username: 1000 AVAHI_DISABLE: true WSDD2_DISABLE: true #NETBIOS_DISABLE: true SAMBA_VOLUME_CONFIG_semaphore: "[myshare]; path=/shares/myshare; valid users ...
🌐
Docker Hub
hub.docker.com › r › jenserat › samba-publicshare
jenserat/samba-publicshare - Docker Image
To share a folder, bind it as a volume to the internal path /srv and expose the ports required by the SMB protocol. An example would be · docker run -td \ --publish 445:445 \ --publish 137:137 \ --publish 138:138 \ --publish 139:139 \ --volume /srv/samba:/srv \ jenserat/samba-publicshare Copy
🌐
GitHub
github.com › ahmetozer › docker-samba
GitHub - ahmetozer/docker-samba: It's a container image. It has a auto configrator tool to easy and fast install. You can manage your network shares with single commands. · GitHub
Note: You can't add outside of docker container folder to share with samba after first run. If you want to share outside of the container folder, you have to use -v argument to bind Moby folder to container folder. ... 36f60553d4aa:/# shareadd Share Name » newshare Share Comment » newshare Directory Share path » /share/newshare Valid users for newshare » newshare Re generating config file Reloading samba service ### OR 36f60553d4aa:/# shareadd newshare "/share/newshare" "newshareuser" "newshare Directory" Share Name » newshare Share Comment » newshare Directory Share path » /share/newshare Valid users for newshare » newshareuser Re generating config file Reloading samba service
Starred by 3 users
Forked by 10 users
Languages   Shell 97.5% | Dockerfile 2.5%
🌐
DevOps in progress
devopsinprog.hashnode.dev › sharing-files-in-my-local-network-with-samba-docker-and-ansible
Simple File Sharing on LAN with Samba - DevOps in progress
June 12, 2025 - - name: Create share folder for Samba ansible.builtin.file: path: /srv/samba_share state: directory mode: "0777" What it does: Creates the /srv/samba_share directory with full access permissions (777) if it doesn't exist. Why: This folder will be mapped as a Samba share, so it needs to exist and be writable by everyone (this can be refined later, but full permissions help during testing). - name: Create Docker container with Samba community.docker.docker_container: name: samba image: dperson/samba restart_policy: unless-stopped published_ports: - "139:139" - "445:445" volumes: - "/srv/samba_share:/mount" command: -u "{{ vault_vars.samba_user }};{{ vault_vars.samba_pass }}" -s "share;/mount;yes;no;yes"
🌐
Docker Hub
hub.docker.com › r › filedash › samba
filedash/samba - Docker Image
A simple, containerized Samba file server for easy network file sharing.
🌐
Docker Hub
hub.docker.com › r › sixeyed › samba
sixeyed/samba - Docker Image
samba: container_name: samba hostname: ... "music;/mnt/audio/music;yes;no;yes;all" mem_limit: 1g restart: always Copy · Connect to the share using smb:///music and sign in with the guest account (if prompted)....
🌐
Helge Klein
helgeklein.com › blog › samba-file-server-with-windows-acls-in-a-docker-container
Samba File Server With Windows ACLs in a Docker Container
August 24, 2025 - # Usage samba-tool dns delete <server> ... fs1 A 192.168.0.6 -U administrator · The Docker compose file has a bind mount for file shares that is visible in the container as /srv/samba....
Top answer
1 of 2
2

It turnes out, that the problem in fact originates from SELinux policies. Specifically, the podman container process (labeled as container_t) could not access the samba share directory (labeled as samba_share_t).

After some research, I found this post:

  • https://unix.stackexchange.com/questions/728801/host-wide-consequences-of-setting-selinux-z-z-option-on-container-bind-mounts

As described there, we can use ausearch to inspect SELinux denial decisions and create an exception rule for a denial with audit2allow. However, after some back and forth testing, I came up with this SELinux module specification:

module docker-samba 1.0;

require {
    type container_t;
    type samba_share_t;
    type mnt_t;
    class dir { read write setattr getattr create rename open add_name rmdir remove_name lock watch};
    class file { read write setattr getattr create rename open lock unlink append};
}

#============= container_t ==============
allow container_t samba_share_t:dir { read write setattr getattr create rename open add_name rmdir remove_name lock watch};
allow container_t samba_share_t:file { read write setattr getattr create rename open lock unlink append};
allow container_t mnt_t:dir { setattr };

It is based on the official SELinux specification PolicyStatements and ObjectClassesPerms

The module can then be installed as following:

sudo checkmodule -M -m -o docker-samba.mod docker-samba.te
sudo semodule_package -m docker-samba.mod -o docker-samba.pp
sudo semodule -i docker-samba.pp

To check if your module specification was indeed correct, you can again inspect the SELinux denial messages using ausearch as described before.

2 of 2
0

It looks like you using a Linux based docker container, then Z: is not recognized because that's windows/Microsoft

So in your volumes you need to specify a linux path for example /data

volumes:
 -  /mnt/basis/software/docker/syncthing:/var/syncthing

Also make sure the 1006 has enough permissions to the files/directory/share

There is an example docker-compose on their github https://github.com/syncthing/syncthing/blob/main/README-Docker.md

    ---
version: "3"
services:
  syncthing:
    image: syncthing/syncthing
    container_name: syncthing
    hostname: my-syncthing
    environment:
      - PUID=1000
      - PGID=1000
    volumes:
      - /wherever/st-sync:/var/syncthing
    ports:
      - 8384:8384 # Web UI
      - 22000:22000/tcp # TCP file transfers
      - 22000:22000/udp # QUIC file transfers
      - 21027:21027/udp # Receive local discovery broadcasts
    restart: unless-stopped
🌐
Helge Klein
helgeklein.com › blog › samba-active-directory-in-a-docker-container-installation-guide
Samba Active Directory in a Docker Container: Installation Guide
August 27, 2025 - mkdir -p /rpool/encrypted/docker/samba/config-dc1 mkdir -p /rpool/encrypted/docker/samba/config-fs1/kerberos mkdir -p /rpool/encrypted/docker/samba/config-fs1/samba mkdir -p /rpool/encrypted/docker/samba/config-fs1/supervisor mkdir -p /rpool/encrypted/docker/samba/data-dc1 mkdir -p /rpool/encrypted/docker/samba/data-fs1 mkdir -p /rpool/encrypted/docker/samba/dockerfile mkdir -p /rpool/encrypted/docker/samba/shares-fs1 · Create empty files or Docker will mount that as directories instead: