Issue
I try to build my own Docker container with slapd
and Dockerfile
.
Installation of slapd
is OK and then I need to stop slapd
in order to add a custom database.
For that I need to run slapadd
command on a non running slapd
. Nevertheless RUN pkill slapd
produces the following error:
Step 7 : RUN service slapd start ; ldapadd -Y EXTERNAL -H ldapi:/// -f xxx.ldif
---> Using cache
---> 53e1e1a59517
Step 8 : RUN pkill slapd
---> Running in efc0058a4bfe
The command '/bin/sh -c pkill slapd' returned a non-zero code: 1
Do you know why and how I can stop properly slapd
with Dockefile
?
Solution
You are splitting your slapd operations over multiple RUN
directives: that is not practical, as each RUN
will create an intermediate container, and commit that container as an intermediate image.
It is best to group all your operation in one script, that you COPY
first in your image, and then RUN
that script.
That way, inside one intermediate container, you can start/stop slapd, add your ldif files, do other tests, before the intermediate container stops and is committed as a new intermediate image.
Answered By - VonC