Public | Automated Build

Last pushed: a year ago
Short Description
Short description is empty for this repo.
Full Description


A basic configuration of the OpenLDAP server, slapd, with support for data

This image will initialize a basic configuration of slapd. Most common schemas
are preloaded (all the schemas that come preloaded with the default Ubuntu
Precise install of slapd), but the only record added to the directory will be
the root organisational unit.

You can (and should) configure the following by providing environment variables
to docker run:

  • LDAP_DOMAIN sets the LDAP root domain. (e.g. if you provide
    here, the root of your directory will be dc=foo,dc=bar,dc=com)
  • LDAP_ORGANISATION sets the human-readable name for your organisation (e.g.
    Acme Widgets Inc.)
  • LDAP_ROOTPASS sets the LDAP admin user password (i.e. the password for
    cn=admin,dc=example,dc=com if your domain was

For example, to start a container running slapd for the domain,
with data stored in /data/ldap on the host, use the following:

docker run -v /data/ldap:/var/lib/ldap \
           -e \
           -e LDAP_ORGANISATION="My Mega Corporation" \
           -e LDAP_ROOTPASS=s3cr3tpassw0rd \
           -d nickstenning/slapd

You can find out which port the LDAP server is bound to on the host by running
docker ps (or docker port <container_id> 389). You could then load an LDIF
file (to set up your directory) like so:

ldapadd -h localhost -p <host_port> -c -x -D cn=admin,dc=mycorp,dc=com -W -f data.ldif

NB: Please be aware that by default docker will make the LDAP port
accessible from anywhere if the host firewall is unconfigured.

Docker Pull Command
Source Repository

Comments (3)
8 months ago

Is there a possibility to persist LDAP hierarchy ? When I remove container and run a new one. I got error: "credential invalid" even if I have mounted /var/lib/ldap from docker to host.

2 years ago

Once I create a server, when I try to run an ldapadd I get an error of 'ldap_result: Can't contact LDAP server (-1)'

Am I missing something? This is using the run statement exactly as shown in the same, but with my information of course.

2 years ago

i am having trouble getting the slapd up and running.

i ran the command
docker run -v $PWD/docker/ldap/data:/var/lib/ldap -e LDAP_DOMAIN=helmholtz.os -e LDAP_ORGANISATION="helmholtz playground" -e LDAP_ROOTPASS=ldap -d nickstenning/slapd

slapd is not running, instead, when executing "dpkg-reconfigure -f noninteractive slapd" manually to see what is going on, I get this:
dpkg-reconfigure -f noninteractive slapd
invoke-rc.d: policy-rc.d denied execution of stop.
Moving old database directory to /var/backups:

  • directory unknown... done.
    Creating initial configuration... done.
    Creating LDAP directory... failed.
    Loading the initial configuration from the ldif file () failed with
    the following error while running slapadd:
    5651d151 bdb(dc=helmholtz,dc=os): mmap: Invalid argument
    5651d151 hdb_db_open: database "dc=helmholtz,dc=os" cannot be opened, err 22. Restore from backup!
    5651d151 bdb(dc=helmholtz,dc=os): txn_checkpoint interface requires an environment configured for the transaction subsystem
    5651d151 bdb_db_close: database "dc=helmholtz,dc=os": txn_checkpoint failed: Invalid argument (22).
    5651d151 backend_startup_one (type=hdb, suffix="dc=helmholtz,dc=os"): bi_db_open failed! (22)
    slap_startup failed

any ideas?