Skip to content

Commit fba09ec

Browse files
authored
Fix for Issue 56
Fix for Issue 56: #56 Docker does not automatically substitute environment variables in the HEALTHCHECK instruction. add a line to create a health check script with the variables rendered, and adjusted the health check to execute that script. ``` 67e1be24 slapd starting [services.d] done. 67e1be3e conn=1000 fd=138 ACCEPT from IP=127.0.0.1:59546 (IP=0.0.0.0:10389) 67e1be3e conn=1000 op=0 BIND dn="cn=admin,dc=planetexpress,dc=com" method=128 67e1be3e conn=1000 op=0 BIND dn="cn=admin,dc=planetexpress,dc=com" mech=SIMPLE ssf=0 67e1be3e conn=1000 op=0 RESULT tag=97 err=0 text= 67e1be3e conn=1000 op=1 SRCH base="cn=admin,dc=planetexpress,dc=com" scope=2 deref=0 filter="(objectClass=*)" 67e1be3e conn=1000 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text= 67e1be3e conn=1000 op=2 UNBIND 67e1be3e conn=1000 fd=138 closed ```
1 parent 002ff7b commit fba09ec

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,9 @@ EXPOSE 10389 10636
3737

3838
CMD ["/init"]
3939

40-
HEALTHCHECK CMD ["ldapsearch", "-H", "ldap://127.0.0.1:10389", "-D", "${LDAP_BINDDN}", "-w", "${LDAP_SECRET}", "-b", "${LDAP_BINDDN}"]
40+
# Add a healthcheck script
41+
RUN echo '#!/bin/sh' > /healthcheck.sh && \
42+
echo 'ldapsearch -H ldap://127.0.0.1:10389 -D "${LDAP_BINDDN}" -w "${LDAP_SECRET}" -b "${LDAP_BINDDN}" >/dev/null 2>&1 || exit 1' >> /healthcheck.sh && \
43+
chmod +x /healthcheck.sh
44+
45+
HEALTHCHECK CMD /healthcheck.sh

0 commit comments

Comments
 (0)