I am running osixia/openldap and osixia/phpldapadmin (volumes mounted) with these commands :
docker run -p 389:389 -p 636:636 --name ldap-service --volume /data/slapd/database:/var/lib/ldap --volume /data/slapd/config:/etc/ldap/slapd.d --hostname ldap-service --detach osixia/openldap:1.2.3 --copy-service --loglevel debug
docker run --name phpldapadmin-service --hostname phpldapadmin-service --link ldap-service:ldap-host --env PHPLDAPADMIN_LDAP_HOSTS=ldap-host --detach osixia/phpldapadmin:0.7.2
On the first run it starts but on restarting the servers with the same command I got the error
- /container/run/startup/slapd failed with status 34
- whereas status 34 refers to LDAP_INVALID_DN_SYNTAX
could not be able to find a solution for this. Any help?
I have solved this problem.
If you look at the document, you will find error 34 stands for invalid DN
.
When you initialize your ldap server with docker, if startup script did not find your LDAP_BASE_DN
environment variable, it will generate one from LDAP_DOMAIN
, for example, LDAP_DOMAIN="xxx.com"
will lead to LDAP_BASE_DN="dc=xxx,dc=com"
.
But if you stop your container, and start another one with old volume mounted, startup scirpt will not generate LDAP_BASE_DN
from your LDAP_DOMAIN
, when you look at debug log, you will find it is starting up with an empty DN
. That is exactly why it won't start normally.
So the solution is clear: set LDAP_BASE_DN
every time, if you use a docker-compose file, just add it to your "environment" section.