Hi,
I am trying to migrate my OpenLDAP server form a previous (non-dockerised) installation to a dockerised one. On my previous server, I did the following to export the configuration and the users (from serverfault):
slapcat -n 0 -l config.ldif
slapcat -n 1 -l users.ldif
Accoding to the same stop, what I should do on the new server is:
slapd.d folder;slapadd -n 0 -l config.ldif.Unfortunately, I cannot (or do not know how to) do that with your image. I tried the following:
docker cp config.ldif openldap:/config.ldif
docker exec openldap slapadd -n -0 -l config.ldif
But I get the following:
slapadd: could not add entry dn="cn=config" (line=1):
Which, according to this, is because the slapd service is still running and/or the /etc/ldap/slapd.d folder is not empty.
I am fairly new to docker and certainly not an LDAP expert... Is there a way to import my previous configuration and users into this docker image?
Note: I am using a data volume container for both /var/lib/ldap and /etc/ldap/slapd.d.
Hello,
it's hard with this image because it's a single process container, so if you stop openldap the container stops but this can be done more easily with openldap-backup image:
https://github.com/osixia/docker-openldap-backup
/data/backup in the containerslapd-restore-config config.ldifslapd-restore-data users.ldiflet me know if you have any problem :)
Thanx for this entry, it took me hours to figure this way out. This is quite easy and shall really be documented to the image readme. Now its easy to dockerize an already populated installation.
@Boldie I am trying to do the same thing as op here but there is no such command as slapd-restore.
Am i missing something or do i need to take another step first?
I am aware this is pretty old but fingers crossed
Im not really sure what I did, but I think, I used a clean install of the docker container, add my ldif files and then use the restore command. Sure first you need to make a backup of your old installation.
Most helpful comment
Hello,
it's hard with this image because it's a single process container, so if you stop openldap the container stops but this can be done more easily with openldap-backup image:
https://github.com/osixia/docker-openldap-backup
/data/backupin the containerslapd-restore-config config.ldifslapd-restore-data users.ldiflet me know if you have any problem :)