osixia/openldap

By osixia

Updated 3 months ago

OpenLDAP container image with built-in bootstrap, backup, TLS, replication and upgrades 🐳🪪🌴

Image
Security
Databases & storage
460

100M+

osixia/openldap repository overview

⚠️ ⚠️ ⚠️ The stable tag will be removed in the coming weeks, please use the 1.5.0 tag instead.

osixia/openldap 🐳🪪🌴

OpenLDAP container image with built-in bootstrap, TLS, replication, backup helpers, and upgrade support.

⚠️ WARNING v2 is a breaking release. Existing v1 deployments are not migrated automatically and require a manual migration to move to v2. Automatic upgrade paths are intended only between future v2 versions (for example, v2.x to v2.y).

110M+ pulls 🎉 Thanks to everyone using, testing, reporting issues, and contributing to this image. 🙏

osixia/openldap logo.

⚡ Quickstart

Run a basic OpenLDAP server:

docker run --name openldap --hostname ldap.example.org -p 389:3890 -p 636:6360 \
  -e OPENLDAP_BOOTSTRAP_ORGANIZATION="Keycloakers Org" \
  -e OPENLDAP_BOOTSTRAP_SUFFIX="dc=keycloakers,dc=org" \
  osixia/openldap

For persistent deployments, mount config, data, and backup directories:

docker run --name openldap --hostname ldap.example.org -p 389:3890 -p 636:6360 \
  -e OPENLDAP_BOOTSTRAP_ORGANIZATION="Keycloakers Org" \
  -e OPENLDAP_BOOTSTRAP_SUFFIX="dc=keycloakers,dc=org" \
  -v openldap-conf:/etc/openldap/slapd.d \
  -v openldap-data:/var/lib/openldap/openldap-data \
  -v openldap-backups:/var/lib/openldap/openldap-backups \
  osixia/openldap

Notes:

  • Default internal listener ports are 3890 (LDAP) and 6360 (LDAPS), as defined by OPENLDAP_URLS.
  • On first start, passwords are generated if hashed values are empty and printed in logs.
  • Bootstrap runs only when config/data are empty.

A successful response returns the organization entry and the cn=admin account.

🛟 Backup / Restore

The image includes the openldap-ctl helper with backup and restore commands.

Create a full backup:

docker exec openldap container run -- openldap-ctl backup my-backup

Create only a data backup and remove files older than 15 days:

docker exec openldap container run -- openldap-ctl backup my-backup --data --clean 15

This creates files in OPENLDAP_BACKUP_DIR:

  • my-backup-config.gz
  • my-backup-data.gz

Restore a backup:

docker exec openldap container run -- openldap-ctl restore my-backup --force

--force stops the OpenLDAP process if needed, deletes existing data in the target directories, restores the selected databases, then starts OpenLDAP again.

You can also run a cron service to automatically perform regular backups:

docker run --name openldap-cron \
  -u root \
  -v openldap-conf:/etc/openldap/slapd.d \
  -v openldap-data:/var/lib/openldap/openldap-data \
  -v openldap-backups:/var/lib/openldap/openldap-backups \
  osixia/openldap -x openldap-cron

See the OPENLDAP_CRON_JOB environment variable to adjust the cron schedule and behavior.

🔐 TLS

Set OPENLDAP_BOOTSTRAP_TLS=true to configure TLS during bootstrap.

The default certificate paths are:

  • /container/services/openldap/assets/certs/cert.crt
  • /container/services/openldap/assets/certs/cert.key
  • /container/services/openldap/assets/certs/ca.crt

The simplest way is to mount a directory that contains files with exactly those names:

docker run --name openldap --hostname ldap.example.org -p 389:3890 -p 636:6360 \
  -e OPENLDAP_BOOTSTRAP_TLS=true \
  -v $PWD/certs:/container/services/openldap/assets/certs \
  osixia/openldap

If you also set OPENLDAP_BOOTSTRAP_TLS_REQUIRED=true, bootstrap adds TLS-required access rules. That setting is stricter than plain TLS enablement and is intended for deployments where non-TLS client access should be rejected.

🔤 Environment Variables

Core

VariableDescriptionDefault
OPENLDAP_CONF_DIROpenLDAP configuration directory (slapd.d)/etc/openldap/slapd.d
OPENLDAP_DATA_DIROpenLDAP data directory/var/lib/openldap/openldap-data
OPENLDAP_BACKUP_DIRBackup directory used by openldap-ctl backup/var/lib/openldap/openldap-backups
OPENLDAP_MODULES_DIRDirectory used by OpenLDAP dynamic modules/usr/lib/openldap
OPENLDAP_SCHEMAS_DIRDirectory containing LDIF schemas loaded at bootstrap/etc/openldap/schema
OPENLDAP_CUSTOM_MODULES_DIRCustom modules copied at startup/container/services/openldap/assets/module
OPENLDAP_CUSTOM_SCHEMAS_DIRCustom schemas copied at startup/container/services/openldap/assets/schema
OPENLDAP_NOFILEulimit -n value before starting slapd65536
OPENLDAP_DEBUG_LEVELDefault slapd debug level256
OPENLDAP_URLSListener URLs passed to slapd -hldap://:3890 ldaps://:6360 ldapi:///

Bootstrap

VariableDescriptionDefault
OPENLDAP_BOOTSTRAP_ORGANIZATIONOrganization name used in bootstrap dataExample Org
OPENLDAP_BOOTSTRAP_SUFFIXBase LDAP suffixdc=example,dc=org
OPENLDAP_BOOTSTRAP_MODULESOpenLDAP modules loaded during bootstrapback_mdb.so argon2.so refint.so ppolicy.so unique.so memberof.so syncprov.so
OPENLDAP_BOOTSTRAP_SCHEMASLDIF schemas imported during bootstrapcore.ldif cosine.ldif inetorgperson.ldif rfc2307bis.ldif
OPENLDAP_BOOTSTRAP_GLOBAL_SIZE_LIMITGlobal LDAP size limit500
OPENLDAP_BOOTSTRAP_GLOBAL_TIME_LIMITGlobal LDAP time limit120
OPENLDAP_BOOTSTRAP_GLOBAL_IDLE_TIMEOUTGlobal LDAP idle timeout3600
OPENLDAP_BOOTSTRAP_CONFIG_PASSWORD_HASHPassword hash scheme configured in olcPasswordHash{ARGON2}
OPENLDAP_BOOTSTRAP_CONFIG_ROOT_DNRoot DN for cn=configcn=admin,cn=config
OPENLDAP_BOOTSTRAP_CONFIG_ROOT_PASSWORD_HASHEDHashed password for cn=config; generated if empty``
OPENLDAP_BOOTSTRAP_DATA_DATABASE_MAX_SIZEMDB max size for main database10737418240
OPENLDAP_BOOTSTRAP_DATA_ROOT_DNRoot DN for main databasecn=admin,${OPENLDAP_BOOTSTRAP_SUFFIX}
OPENLDAP_BOOTSTRAP_DATA_ROOT_PASSWORD_HASHEDHashed password for main database root DN; generated if empty``
OPENLDAP_BOOTSTRAP_DATA_READONLYEnable read-only data account creationfalse
OPENLDAP_BOOTSTRAP_DATA_READONLY_DNDN of the read-only data accountcn=readonly,${OPENLDAP_BOOTSTRAP_SUFFIX}
OPENLDAP_BOOTSTRAP_DATA_READONLY_PASSWORD_HASHEDHashed password of the read-only data account; generated if empty when enabled``
OPENLDAP_BOOTSTRAP_MONITOR_ENABLEDEnable monitor backendfalse
OPENLDAP_BOOTSTRAP_MONITOR_READONLYEnable read-only monitor account creationfalse
OPENLDAP_BOOTSTRAP_MONITOR_READONLY_DNDN of the read-only monitor accountcn=readonly-monitor,${OPENLDAP_BOOTSTRAP_SUFFIX}
OPENLDAP_BOOTSTRAP_MONITOR_READONLY_PASSWORD_HASHEDHashed password of the read-only monitor account; generated if empty when enabled``
OPENLDAP_BOOTSTRAP_LDIF_CONFIG_DIRSource directory for config LDIF bootstrap files/container/services/openldap-bootstrap/assets/ldif/config
OPENLDAP_BOOTSTRAP_LDIF_DATA_DIRSource directory for data LDIF bootstrap files/container/services/openldap-bootstrap/assets/ldif/data
OPENLDAP_BOOTSTRAP_SCRIPTS_DIRSource directory for bootstrap scripts/container/services/openldap-bootstrap/assets/scripts

TLS

VariableDescriptionDefault
OPENLDAP_BOOTSTRAP_TLSEnable TLS configuration during bootstrapfalse
OPENLDAP_BOOTSTRAP_TLS_CERTServer certificate path/container/services/openldap/assets/certs/cert.crt
OPENLDAP_BOOTSTRAP_TLS_CERT_KEYServer private key path/container/services/openldap/assets/certs/cert.key
OPENLDAP_BOOTSTRAP_TLS_CA_CERTCA certificate path/container/services/openldap/assets/certs/ca.crt
OPENLDAP_BOOTSTRAP_TLS_VERIFY_CLIENTValue for olcTLSVerifyClientallow
OPENLDAP_BOOTSTRAP_TLS_PROTOCOL_MINValue for olcTLSProtocolMin3.4
OPENLDAP_BOOTSTRAP_TLS_REQUIREDEnforce TLS-only access rules during bootstrapfalse

RefInt

VariableDescriptionDefault
OPENLDAP_BOOTSTRAP_REFINTEnable the refint overlay during bootstrapfalse
OPENLDAP_BOOTSTRAP_REFINT_ATTRIBUTESAttributes maintained by the refint overlaymember uniqueMember manager owner

PPolicy

VariableDescriptionDefault
OPENLDAP_BOOTSTRAP_PPOLICYEnable the password policy overlay during bootstrapfalse
OPENLDAP_BOOTSTRAP_PPOLICY_HASH_CLEAR_TEXTValue for olcPPolicyHashCleartexttrue
OPENLDAP_BOOTSTRAP_PPOLICY_USE_LOCKOUTValue for olcPPolicyUseLockouttrue
OPENLDAP_BOOTSTRAP_PPOLICY_CHECK_MODULEOptional value for olcPPolicyCheckModule``
OPENLDAP_BOOTSTRAP_PPOLICY_GROUP_DNDN of the policy container created in the main databaseou=Policies,${OPENLDAP_BOOTSTRAP_SUFFIX}
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_POLICY_DNDN of the default password policycn=default,${OPENLDAP_BOOTSTRAP_PPOLICY_GROUP_DN}
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_MIN_LENGTHValue for pwdMinLength12
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_CHECK_QUALITYValue for pwdCheckQuality0
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_IN_HISTORYValue for pwdInHistory12
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_ALLOW_USER_CHANGEValue for pwdAllowUserChangetrue
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_SAFE_MODIFYValue for pwdSafeModifytrue
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_MUST_CHANGEValue for pwdMustChangefalse
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_MIN_AGEValue for pwdMinAge0
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_MAX_FAILUREValue for pwdMaxFailure5
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_FAILURE_COUNT_INTERVALValue for pwdFailureCountInterval300
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_LOCKOUTValue for pwdLockouttrue
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_LOCKOUT_DURATIONValue for pwdLockoutDuration900
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_MAX_AGEValue for pwdMaxAge7776000
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_EXPIRE_WARNINGValue for pwdExpireWarning1209600
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_GRACE_AUTH_NLIMITValue for pwdGraceAuthNLimit3

Unique

VariableDescriptionDefault
OPENLDAP_BOOTSTRAP_UNIQUEEnable the unique overlay during bootstrapfalse
OPENLDAP_BOOTSTRAP_UNIQUE_URISURIs enforced by the unique overlayldap:///?uid?sub ldap:///?mail?sub

MemberOf

VariableDescriptionDefault
OPENLDAP_BOOTSTRAP_MEMBEROFEnable the memberof overlay during bootstrapfalse
OPENLDAP_BOOTSTRAP_MEMBEROF_GROUP_OCObjectClass treated as a group by memberofgroupOfNames
OPENLDAP_BOOTSTRAP_MEMBEROF_MEMBER_ADGroup membership attribute watched by memberofmember
OPENLDAP_BOOTSTRAP_MEMBEROF_MEMBEROF_ADReverse membership attribute maintained by memberofmemberOf
OPENLDAP_BOOTSTRAP_MEMBEROF_ADD_CHECKCheck new entries against existing groups on Addtrue
OPENLDAP_BOOTSTRAP_MEMBEROF_DANGLINGHandling of group members that do not exist yetignore

Replication

VariableDescriptionDefault
OPENLDAP_BOOTSTRAP_REPLICATIONEnable replication bootstrapfalse
OPENLDAP_BOOTSTRAP_REPLICATION_HOSTSReplication endpoints list; at least two, same order on every serverldap://ldap1.example.org:3890 ldap://ldap2.example.org:3890
OPENLDAP_BOOTSTRAP_REPLICATION_SYNCPROV_CHECKPOINTsyncprov checkpoint configuration100 10
OPENLDAP_BOOTSTRAP_REPLICATION_DATA_READONLY_DNReplication account DN for the main databasecn=data-replicator,${OPENLDAP_BOOTSTRAP_SUFFIX}
OPENLDAP_BOOTSTRAP_REPLICATION_DATA_READONLY_PASSWORDPlain password for the data replication account; generated if empty``
OPENLDAP_BOOTSTRAP_REPLICATION_DATA_SYNC_REPL_TEMPLATETemplate used to generate data olcSyncReplrid=\${OPENLDAP_BOOTSTRAP_REPLICATION_DATA_SYNC_REPL_RID} ...
OPENLDAP_BOOTSTRAP_REPLICATION_DATA_LIMITSLimits ACL for the data replication accountdn.exact="${OPENLDAP_BOOTSTRAP_REPLICATION_DATA_READONLY_DN}" ...
OPENLDAP_BOOTSTRAP_REPLICATION_TLSEnable TLS settings in generated replication config${OPENLDAP_BOOTSTRAP_TLS_REQUIRED}
OPENLDAP_BOOTSTRAP_REPLICATION_TLS_SYNC_REPLExtra syncrepl TLS optionsstarttls=critical tls_reqcert=demand
OPENLDAP_BOOTSTRAP_REPLICATION_MEMBEROFEnable memberof settings in generated replication config${OPENLDAP_BOOTSTRAP_MEMBEROF}
OPENLDAP_BOOTSTRAP_REPLICATION_MEMBEROF_SYNC_REPLExtra syncrepl option used when memberof replication handling is enabledexattrs=${OPENLDAP_BOOTSTRAP_MEMBEROF_MEMBEROF_AD}

Helpers and Maintenance

VariableDescriptionDefault
OPENLDAP_CTL_BACKUP_CONFIG_FILE_SUFFIXSuffix used for config backups-config.gz
OPENLDAP_CTL_BACKUP_DATA_FILE_SUFFIXSuffix used for data backups-data.gz
OPENLDAP_CTL_PASSWORD_GENERATE_CMDCommand used by openldap-ctl password generateslappasswd -n -g; slappasswd -g
OPENLDAP_CTL_PASSWORD_HASH_CMDCommand used by openldap-ctl password hashslappasswd -h {ARGON2} -o module-path=${OPENLDAP_MODULES_DIR} -o module-load=argon2
OPENLDAP_CTL_SCHEMA2LDIF_DEPENDENCIESDefault schema dependencies for schema2ldifcore.schema cosine.schema inetorgperson.schema
OPENLDAP_CRON_JOBCron job used by the backup service15 2 * * * PATH=${PATH} container run -- openldap-ctl backup "$(date -I)-${OPENLDAP_VERSION}-openldap-cron" --clean 15
OPENLDAP_UPGRADE_FORCEAllow upgrade bypasses, including forced downgrade handlingfalse
OPENLDAP_UPGRADE_MIGRATION_LEVELAllowed migration levelminor
OPENLDAP_UPGRADE_BACKUP_FILES_PREFIXPrefix for upgrade backup filesopenldap-upgrade
OPENLDAP_UPGRADE_CONF_VERSION_FILEFile storing the current config version${OPENLDAP_CONF_DIR}/.version

📄 Documentation

See full documentation and complete features list on osixia/openldap documentation.

This image is based on osixia/baseimage.

⭐ Source Code

Browse source code and contribute to this project on GitHub.

Tag summary

Content type

Image

Digest

sha256:80a577d7d

Size

15.2 MB

Last updated

3 months ago

docker pull osixia/openldap:2.6.10-alpha