Public | Automated Build

Last pushed: a month ago
Short Description
Full Description



  1. From DockerHUB

     docker pull d0u9/samba

    For china users, use aliyun docker mirror instead:

     docker pull
  2. From DockerFile

     cd /tmp
     docker build -f </path/to/Dockerfile> -t samba .


  1. Run container

     docker -d \
         --name <container_name> \
         -p 139:139 \
         -p 445:445 \
         -v <samba_etc>:/var/samba \
         -v [one or more mount path according to your needs] \


    Here, in the container, the /etc/samba dir is a symbolic link to
    /var/samba. So you can bind-mount any samba configuration dir
    <samba_ect> into the container in /var/samba, and in turn be linked to

    If the <samba_etc> dir is empty, the first run of the image will create
    the default configuration files there. You can manually modify this
    configuration file. Docker will load these settings after a restart of the

  2. Automatically start container after booting

    Create /etc/systemd/system/docker-deluge_web.service, and fill with
    contents below:

     Description=Samba Container
     ExecStart=/usr/bin/docker start -a <container_name>
     ExecStop=/usr/bin/docker stop -t 2 <container_name>


  1. User & Group management

    Samba server tightly depends on the system's user and group if you want to
    benefit from the [homes] section in the smb.conf file. So, how to
    migrate these users and groups after a image upgrade is very important. To
    achieve this goal, I wrote some bash scripts to easy this dirty task.
    Anyone who are curious about the impletation can check my github.

    Let me show you how to migrate.

    if you want to export all the users and groups, simply execute the command

     docker exec -it <container_name> smb_export

    This command will crate a directory named migration in the /var/samba.
    Remember that we have bind-mounted a host dir into it.

    After stop, remove and upgrade the image, run the container as before. And
    then execute the command:

     docker exec -it <container_name> smb_import

    This command will find the migration directory in the /var/samba, if
    there it is and it is valid, all the users and groups will be imported


    the password for samba user is defauly saved somewhere according to the
    smb.conf file. This loacation can be change by adding(or modifying) the
    passdb backend field (if you use samba as a standalone server, and manage
    users via passdb):

     passdb backend = tdbsam:/etc/samba/passdb.tdb

Docker Pull Command
Source Repository