Sign inSign up

osixia/openldap

By osixia

•Updated 13 days ago

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

Image
Security
Databases & storage
461

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, backup helpers, TLS, replication 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.
  • OPENLDAP_BOOTSTRAP_SUFFIX must start with dc= (for example dc=example,dc=org).

⁠🛟 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 backups older than 15 days whose name starts with my-:

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

Without --clean-prefix, --clean removes all old backups in OPENLDAP_BACKUP_DIR. Other files are never removed.

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, replaces existing data in the target directories with the selected databases, then starts OpenLDAP again. Backup files are checked first: if one is missing or corrupted, nothing is stopped or deleted. If the restore fails, the previous data is put back.

The cron service is disabled by default. To schedule regular backups, run it in a separate container alongside OpenLDAP, sharing its configuration, data, and backup volumes:

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/tls.crt
  • /container/services/openldap/assets/certs/tls.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 slapd8192
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 suffix; must start with dc=dc=example,dc=org
OPENLDAP_BOOTSTRAP_MODULESauto: base and enabled feature modules; an explicit list sets the exact modules and orderauto
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_GLOBAL_WRITE_TIMEOUTTimeout for blocked network writes, in seconds (0: disabled)0
OPENLDAP_BOOTSTRAP_GLOBAL_CONN_MAX_PENDINGMaximum pending requests per anonymous connection100
OPENLDAP_BOOTSTRAP_GLOBAL_CONN_MAX_PENDING_AUTHMaximum pending requests per authenticated connection1000
OPENLDAP_BOOTSTRAP_GLOBAL_SOCKBUF_MAX_INCOMINGMaximum incoming LDAP message size for anonymous connections, in bytes262143
OPENLDAP_BOOTSTRAP_GLOBAL_SOCKBUF_MAX_INCOMING_AUTHMaximum incoming LDAP message size for authenticated connections, in bytes4194303
OPENLDAP_BOOTSTRAP_FRONTEND_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_LAST_BINDTrack successful LDAP authentications in pwdLastSuccessfalse
OPENLDAP_BOOTSTRAP_DATA_LAST_BIND_PRECISIONMinimum interval between pwdLastSuccess updates, in seconds3600
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_TREECreate the users, groups and services OUsfalse
OPENLDAP_BOOTSTRAP_DATA_TREE_USERS_DNUsers OU DNou=users,${OPENLDAP_BOOTSTRAP_SUFFIX}
OPENLDAP_BOOTSTRAP_DATA_TREE_GROUPS_DNGroups OU DNou=groups,${OPENLDAP_BOOTSTRAP_SUFFIX}
OPENLDAP_BOOTSTRAP_DATA_TREE_SERVICES_DNServices OU DNou=services,${OPENLDAP_BOOTSTRAP_SUFFIX}
OPENLDAP_BOOTSTRAP_DATA_ADMINCreate an account to administer users and groupsfalse
OPENLDAP_BOOTSTRAP_DATA_ADMIN_DNScoped administrator DNcn=admin,${OPENLDAP_BOOTSTRAP_DATA_TREE_SERVICES_DN}
OPENLDAP_BOOTSTRAP_DATA_ADMIN_PASSWORD_HASHEDHashed administrator password; generated if empty when enabled``
OPENLDAP_BOOTSTRAP_DATA_MANAGEMENTEnable user/group reads and user password resetsfalse
OPENLDAP_BOOTSTRAP_DATA_MANAGEMENT_DNManagement account DNcn=management,${OPENLDAP_BOOTSTRAP_DATA_TREE_SERVICES_DN}
OPENLDAP_BOOTSTRAP_DATA_MANAGEMENT_PASSWORD_HASHEDHashed management password; generated if empty when enabled``
OPENLDAP_BOOTSTRAP_DATA_MANAGEMENT_HIDDEN_ATTRIBUTESComma-separated attributes hidden from the management accountuserPassword,shadowLastChange
OPENLDAP_BOOTSTRAP_DATA_MANAGEMENT_HIDDEN_PPOLICY_ATTRIBUTESAdditional hidden attributes when ppolicy is enabledpwdHistory
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_MONITOREnable 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_AUDITLOGLog successful LDAP writesfalse
OPENLDAP_BOOTSTRAP_AUDITLOG_FILEAudit LDIF file; requires a writable parent directory/var/log/openldap/audit.ldif
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/tls.crt
OPENLDAP_BOOTSTRAP_TLS_CERT_KEYServer private key path/container/services/openldap/assets/certs/tls.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
OPENLDAP_BOOTSTRAP_REFINT_NOTHING_DNReplacement DN for empty groups; automatically creates a passwordless role when set``

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 pwdCheckQuality1
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_MIN_DELAYInitial per-account lockout after a failed bind, in seconds (0: disabled)0
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_MAX_DELAYMaximum progressive lockout in seconds; requires 0 < MIN_DELAY <= MAX_DELAY and policy lockout enabled0
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_MAX_AGEValue for pwdMaxAge7776000
OPENLDAP_BOOTSTRAP_PPOLICY_DEFAULT_MAX_IDLEMaximum inactivity in seconds (0: disabled); requires last bind tracking and policy lockout0
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; two to nine, 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=replicator,${OPENLDAP_BOOTSTRAP_SUFFIX}
OPENLDAP_BOOTSTRAP_REPLICATION_DATA_READONLY_PASSWORDPlain password for the data replication account, without "; 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}

⁠📄 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:3f6875129…

Size

87.4 MB

Last updated

over 5 years ago

docker pull osixia/openldap