Public | Automated Build

Last pushed: 2 years ago
Short Description
Samba 4 for Active directory integration - IoT gateway needs with bind9 dns binding
Full Description

Samba4 AD-DC docker container

This is a docker container running Samba4 as a domain controller.

The first time you start the container, a setup-script will run and provision the domain controller using the supplied environment variables.
After the setup has finished successfully, the container will continue starting (unless SAMBA_SETUP_ONLY is set) and start the domain controller.

The container saves all necessary files within /var/lib/samba.
See the following examples on how to start/setup the domain controller and how to persist this volume.


Persist volume to local directory

docker run --rm -i -t \
    -e SAMBA_REALM="samba.dom" \
    -e SAMBA_PASSWORD="Password1!" \
    -e SAMBA_HOST_IP="" \
    -v ${PWD}/samba:/var/lib/samba \

Persist volume using a data-container

docker run \
    --name dc_data \
    --volume /var/lib/samba \
    --entrypoint /bin/true \

(The image used to start the data-container can be chosen arbitrarily, as long as it supplies /bin/true or any other binary resulting in immediate exit.)

docker run --rm -i -t \
    -e SAMBA_REALM="samba.dom" \
    -e SAMBA_PASSWORD="Password1!" \
    -e SAMBA_HOST_IP="" \
    --volumes-from dc_data \

Environment variables

The following environment variables are all used as part of the DC setup process.
If the DC has been setup, none of these variables have any effect on the container!

  • SAMBA_REALM (required) The realm (comparable to the FQDN) for the domain controller (e.q. samba.dom).
  • SAMBA_DOMAIN (optional) The domain (comparable to the NetBios-name) for the domain controller (e.g. samba).
    If it is not supplied, the first part of the FQDN/SAMBA_REALM will be used.
  • SAMBA_PASSWORD (optional) The password for the DC-Administrator.
    If not supplied, a random, 20 character long alphanumeric password will be generated and printed to stdout.
  • SAMBA_OPTIONS (optional) Additional options for samba-tool domain provision.
  • SAMBA_HOST_IP (optional) Set the IPv4 address during provisioning.
    (If you need to set a IPv6 address, supply --host-ip6=IP6ADDRESS through SAMBA_OPTIONS.)
  • SAMBA_DNS_FORWARDER (optional) You can supply the dns-forwarder Samba will use to answer non-local DNS-requests clients submit.
  • SAMBA_SETUP_ONLY (optional) If this variable is set to a arbitrary non-empty string, the container will stop (with a non-zero exit code!) after the setup has finished and does not launch samba/the domain controller.
    If the container is already setup, this variable has no effect.
Docker Pull Command
Source Repository