OpenLDAP server but dockerized
  • Dockerfile 57%
  • Shell 25.1%
  • Go Template 17.9%
Find a file
2026-06-24 23:39:26 +03:00
Dockerfile Update version to 2.6.13 and improve the entrypoint script as well as environment variable naming conventions 2026-06-24 23:39:26 +03:00
entrypoint.sh Update version to 2.6.13 and improve the entrypoint script as well as environment variable naming conventions 2026-06-24 23:39:26 +03:00
init.ldif.tmpl Update version to 2.6.13 and improve the entrypoint script as well as environment variable naming conventions 2026-06-24 23:39:26 +03:00
postfix-book.ldif Add postfix-book schema ldif 2026-02-24 22:42:11 +02:00
README.md Update version to 2.6.13 and improve the entrypoint script as well as environment variable naming conventions 2026-06-24 23:39:26 +03:00
slapd.ldif.tmpl Update version to 2.6.13 and improve the entrypoint script as well as environment variable naming conventions 2026-06-24 23:39:26 +03:00

Docker OpenLDAP

This repository provides the Dockerfile and other files for building your own dockerized OpenLDAP server, making the process of setting up and deploying your own OpenLDAP server much easier.

In this configuration, the OpenLDAP server is mainly meant for keeping track of users and groups, thus by default, creating organizationalUnits of ou=people,dc=example,dc=org and ou=groups,dc=example,dc=org.

Getting started

First you should build and tag the container. By default, the included Containerfile compiles OpenLDAP version 2.6.13.

$ docker build -t registry.example.com/openldap:2.6.13 . -f Dockerfile

After the container building has finished, you can spin up the container using following commands:

$ docker run \
    -p 127.0.0.1:389:389 \
    -v ./_volume/openldap:/var/lib/openldap \
    -e OPENLDAP_LDAP_DOMAIN=example.org \
    -e OPENLDAP_ADMIN_CN=admin \
    -e OPENLDAP_ADMIN_PASSWD=<password> \
    -e OPENLDAP_ORGANIZATION="My awesome organization" \
    registry.example.com/openldap:2.6.13

Alternatively for running in TLS mode:

$ docker run \
    -p 127.0.0.1:389:389 \
    -v ./_volume/openldap:/var/lib/openldap \
    -v ./_volume/certs:/etc/certs/ldap:ro \
    -e OPENLDAP_TLS_CERT_FILE=/etc/certs/ldap/fullchain.pem \
    -e OPENLDAP_TLS_CERT_KEY_FILE=/etc/certs/ldap/privkey.pem \
    -e OPENLDAP_LDAP_DOMAIN=example.org \
    -e OPENLDAP_ADMIN_CN=admin \
    -e OPENLDAP_ADMIN_PASSWD=<password> \
    -e OPENLDAP_ORGANIZATION="My awesome organization" \
    registry.example.com/openldap:2.6.13

List of possible environment variables is as follows:

  • OPENLDAP_DOMAIN specifies the domain name to use, in hostname notation (by default: example.org);
  • OPENLDAP_ADMIN_CN common name for the root user (by default: admin);
  • OPENLDAP_ADMIN_PASSWD password for the root user (by default: password);
  • OPENLDAP_ORGANIZATION name of the organization in its domain entry (by default: Example Organization).
  • OPENLDAP_TLS_CERT_FILE path to the TLS certificate file
  • OPENLDAP_TLS_CERT_KEY_FILE path to the TLS certificate key file.

Container runs slapd with uid/gid of 101, so make sure that volumes have appropriate permissions.