If prepopulation data is provided, the container only starts once and then never again:
$ mkdir prepopulate
$ cat > prepopulate/test.ldif
dn: ou=example,dc=example,dc=org
objectClass: organizationalUnit
ou: example
$ podman run --name test-ldap -e 'SLAPD_PASSWORD=12345' -e 'SLAPD_DOMAIN=example.org' -v "$PWD/prepopulate:/etc/ldap.dist/prepopulate" docker.io/dinkel/openldap:latest
657312c4.38b3a632 0x7f474441e200 @(#) $OpenLDAP: slapd 2.5.13+dfsg-5 (Feb 8 2023 01:56:12) $
Debian OpenLDAP Maintainers <pkg-openldap-devel@lists.alioth.debian.org>
657312c4.38f56d00 0x7f474441e200 slapd starting
^C657312c7.37ac3eae 0x7f4702fff6c0 daemon: shutdown requested and initiated.
657312c7.37b0a93b 0x7f4702fff6c0 slapd shutdown: waiting for 0 operations/tasks to finish
$ podman start --attach test-ldap
Info: Container already configured, therefore ignoring SLAPD_xxx environment variables and preseed files
mdb_id2entry_put: mdb_put failed: MDB_KEYEXIST: Key/data pair already exists(-30799) "ou=example,dc=example,dc=org"
=> mdb_tool_entry_put: id2entry_add failed: err=-30799
=> mdb_tool_entry_put: txn_aborted! MDB_KEYEXIST: Key/data pair already exists (-30799)
slapadd: could not add entry dn="ou=example,dc=example,dc=org" (line=1): txn_aborted! MDB_KEYEXIST: Key/data pair already exists (-30799)
This is because the check that guards loading the propupulation data checks for /var/lib/ldap/DB_CONFIG, but that file is only created by the berkeley db backend of openldap, but the new default backend in openldap after version 2.5 has been changed to mdb. This means a freshly populated /var/lib/ldap looks like this:
$ ls -l /var/lib/ldap
total 64
-rw------- 1 openldap openldap 61440 Dec 8 13:04 data.mdb
-rw------- 1 openldap openldap 8192 Dec 8 13:04 lock.mdb
and the prepopulation code path will be run every time, failing on every start but the first.
If prepopulation data is provided, the container only starts once and then never again:
This is because the check that guards loading the propupulation data checks for
/var/lib/ldap/DB_CONFIG, but that file is only created by the berkeley db backend of openldap, but the new default backend in openldap after version 2.5 has been changed to mdb. This means a freshly populated/var/lib/ldaplooks like this:and the prepopulation code path will be run every time, failing on every start but the first.