osixia / docker-openldap

OpenLDAP container image 🐳🌴
MIT License
4.03k stars 974 forks source link

Start stop the slapd service from the image ? #21

Open reyman opened 8 years ago

reyman commented 8 years ago

Hi,

I test the connection to my ldap with :

root@e8fe2bd50c3a:~# ldapsearch -x -h localhost -b dc=comnmodel,dc=org -D "cn=admin,dc=comnmodel,dc=org" -W admin -Z

and it works.

Now i want to configure the slapd.conf with correct information, so i change info into this file, and after that i'm connect into the docker image to reload the slapd.conf. When i run a service stop on slapd, i see that the stop command doesn't stop the daemon.

Is it normal ?

osixia commented 8 years ago

Hi, yes it's normal slapd run as a foreground process in the image. The daemon is not used. Also all changes made in slapd.conf are not used.

To change se configuration start a container using docker volume to persist data : (minimal example)

docker run -h ldap.example.org -v /data/slapd/database:/var/lib/ldap \ -v /data/slapd/config:/etc/ldap/slapd.d -d osixia/openldap

make changes using ldapadd or ldapmodify with ldif files. ldapadd -x -h ldap.example.org -b dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin -f /data/myfile.ldif

If you need to restart slapd: stop the container and restart a new container using the same command as before (same volumes will be used).

reyman commented 8 years ago

Ok, so if i understand well the documentation of docker, volume are not mounted automatically when you run image.

User need to indicate a -v option with the two possible mounted volume used by your image, isn't it ? If this option -v is not set, this directory doesn't exist on the vps hosting machine.

Perhaps you can add this information about volume/persistence example you say here on the wiki for noob on docker like me :)