Sign inSign up

tkaefer/alpine-samba-ad-container

By tkaefer

Updated almost 4 years ago

Alpine Linux based Samba 4 AD container

Image
2

10K+

tkaefer/alpine-samba-ad-container repository overview

Samba 4 AD container based on Alpine Linux

Credits

Some parts are collected from:

Usage

Without any config and thrown away when terminated:

docker run -it --rm tkaefer/alpine-samba-ad-container
Environment variables

Environment variables are controlling the way how this image behaves therefore please check this list an explanation:

VariabaleExplanationDefault
SAMBA_DOMAINThe domain name used for Samba ADSAMDOM
SAMBA_REALMThe realm for authentication (eg. Kerberos)SAMDOM.EXAMPLE.COM
LDAP_ALLOW_INSECUREAllow insecure LDAP setup, by using unecrypted password. Please use only in debug and non productive setups.false
SAMBA_ADMIN_PASSWORDThe samba admin user passwordset to $(pwgen -cny 10 1)
KERBEROS_PASSWORDThe kerberos passwordset to $(pwgen -cny 10 1)
Use existing data

Using (or reusing data) is done by providing

  • /etc/samba/smb.conf
  • /etc/krb5.conf
  • /usr/lib/samba/
  • /var/lib/krb5kdc/

as volumes to the docker container.

Example
Plain docker
touch /tmp/krb-conf/krb5.conf

docker run -d -e SAMBA_DOMAIN=TEST -e SAMBA_REALM=TEST.MYDOMAIN.COM -v /tmp/smb-conf:/etc/samba -v /tmp/krb-conf/krb5.conf:/etc/krb5.conf -v /tmp/smb-data:/var/lib/samba -v /tmp/krb-data:/var/lib/krb5kdc --name smb4ad tkaefer/alpine-samba-ad-container

For details how to store data in directories, containers etc. please check the Docker documentation for details.

Docker compose

Get the docker-compose.yaml file from the github repo. Copy it to an appropriate directory, do a touch /tmp/krb-conf/krb5.conf and run docker-compose up -d within that directory.

Watch the logs via docker-compose logs -f.

notes

Create clean volumes

if [ -d $HOME/tmp ]; then echo "Removing tmp dir"; rm -rf $HOME/tmp; fi; \
echo "Creating tmp dir" \
&& mkdir -p $HOME/tmp/krb-conf \
&& mkdir $HOME/tmp/krb-data \
&& mkdir $HOME/tmp/smb-conf \
&& touch $HOME/tmp/krb-conf/krb5.conf \
&& docker volume rm samba-data \
&& docker volume create samba-data

Run an instance

docker volume create samba-data

docker run -it --rm --cap-add SYS_ADMIN \
-e SAMBA_ADMIN_PASSWORD=...secr3t... \
-e SAMBA_DOMAIN=local \
-e SAMBA_REALM=local.patodiaz.io \
-e LDAP_ALLOW_INSECURE=true \
--mount type=bind,source=$HOME/tmp/krb-conf/krb5.conf,target=/etc/krb5.conf \
--mount type=bind,source=$HOME/tmp/krb-data,target=/var/lib/krb5kdc \
--mount type=bind,source=$HOME/tmp/smb-conf,target=/etc/samba \
--mount type=volume,source=samba-data,target=/var/lib/samba \
-p 389:389 \
--name smb4ad \
padiazg/samba4dc

Tag summary

Content type

Image

Digest

sha256:1c95bbae3

Size

89 MB

Last updated

almost 4 years ago

docker pull tkaefer/alpine-samba-ad-container