
The image is based on Debian stable ("stretch" at the moment). The Dockerfile is inspired by https://registry.hub.docker.com/u/cnry/openldap/, but as said before, running a stable Debian and be a little less verbose, but more complete in the configuration.
NOTE: On purpose, there is no secured channel (TLS/SSL), because I believe that
this service should never be exposed to the internet, but only be used directly
by other Docker containers using the --link option.
The most simple form would be to start the application like so (however this is not the recommended way - see below):
docker run -d -p 389:389 -e SLAPD_PASSWORD=mysecretpassword -e SLAPD_DOMAIN=ldap.example.org dinkel/openldap
To get the full potential this image offers, one should first create a data-only container or (named) volumes (see "Data persistence" below) and start the OpenLDAP daemon in one of these ways:
docker run -d --volumes-from your-data-container [CONFIG] dinkel/openldap docker run -d --volume your-config-volume:/etc/ldap --volume your-data-volume:/var/lib/ldap [CONFIG] dinkel/openldap
An application talking to OpenLDAP should then --link the container:
docker run -d --link openldap:openldap image-using-openldap
The name after the colon in the --link section is the hostname where the
OpenLDAP daemon is listening to (the port is the default port 389).
For the first run, one has to set at least the first two environment variables.
After the first start of the image (and the initial configuration), these
envirnonment variables are not evaluated again (see the
SLAPD_FORCE_RECONFIGURE option).
SLAPD_PASSWORD (required) - sets the password for the admin user.
SLAPD_DOMAIN (required) - sets the DC (Domain component) parts. E.g. if one sets
it to ldap.example.org, the generated base DC parts would be ...,dc=ldap,dc=example,dc=org.
SLAPD_ORGANIZATION (defaults to $SLAPD_DOMAIN) - represents the human readable
company name (e.g. Example Inc.).
SLAPD_CONFIG_PASSWORD - allows password protected access to the dn=config
branch. This helps to reconfigure the server without interruption (read the
official documentation).
SLAPD_ADDITIONAL_SCHEMAS - loads additional schemas provided in the slapd
package that are not installed using the environment variable with comma-separated
enties. As of writing these instructions, there are the following additional schemas
available: collective, corba, duaconf, dyngroup, java, misc, openldap,
pmi and ppolicy.
SLAPD_ADDITIONAL_MODULES - comma-separated list of modules to load. It will try
to run .ldif files with a corresponsing name from the module directory.
Currently only memberof and ppolicy are avaliable.
SLAPD_FORCE_RECONFIGURE - (defaults to false) Used if one needs to reconfigure
the slapd service after the image has been initialized. Set this value to true
to reconfigure the image.
The ppolicy module provides enhanced password management capabilities that are
applied to non-rootdn bind attempts in OpenLDAP. In order to it, one has to load
both the schema ppolicy and the module ppolicy:
-e SLAPD_DOMAIN=ldap.example.org -e SLAPD_ADDITIONAL_SCHEMAS=ppolicy -e SLAPD_ADDITIONAL_MODULES=ppolicy`
There is one additional environment variable available:
SLAPD_PPOLICY_DN_PREFIX - (defaults to cn=default,ou=policies) sets the dn
prefix used in modules/ppolicy.ldif for the olcPPolicyDefault attribute. The
value used for olcPPolicyDefault is derived from $SLAPD_PPOLICY_DN_PREFIX,(dc component parts from $SLAPD_DOMAIN).After loading the module, you have to load a default password policy. The
contents of default-policy.ldif should look something like this:
CODE_TOKEN_0
See the docs for descriptions on the available attributes and what they mean.
Assuming you are on a host that has the client side tools installed (maybe you have to change the hostname as well), run:
ldapadd -h localhost -x -c -D 'cn=admin,dc=ldap,dc=example,dc=org' -w [$SLAPD_PASSWORD] -f default-policy.ldif
or use the prepopulation capability described below.
There are some use cases where it is desired to prepopulate the database with
some data before launching the container. In order to do that, one can mount a
host directory as a data volume in /etc/ldap.dist/prepopulate. Each LDIF file
is run through slapadd in alphabetical order. E.g.
docker run -d --volume /path/to/dir/with/ldif-files:/etc/ldap.dist/prepopulate [CONFIG] dinkel/openldap
Please note that the prepopulation files are only processed on the containers first run (a.k.a. as long as there is no data in the database).
The image exposes two directories (VOLUME ["/etc/ldap", "/var/lib/ldap"]).
The first holds the "static" configuration while the second holds the actual
database. Please make sure that these two directories are saved (in a data-only
container or alike) in order to make sure that everything is restored after a
restart of the container.



探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务