From a83c87f2706cd356dd8645167077fb28d367bcf5 Mon Sep 17 00:00:00 2001 From: Marisa Date: Sun, 26 Oct 2025 14:52:28 -0400 Subject: [PATCH] Update dockerfile --- dockerfile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dockerfile b/dockerfile index 13a8852..b10fa13 100644 --- a/dockerfile +++ b/dockerfile @@ -17,15 +17,25 @@ RUN echo "slapd slapd/password1 password admin" | debconf-set-selections && \ # make use of debconf-set-selections RUN dpkg-reconfigure -f noninteractive slapd +# create a script to automatically start slapd while this dockerfile is being parsed +COPY start-slapd.sh ./start-slapd.sh +RUN chmod +x ./start-slapd.sh + # open up LDAP simple port EXPOSE 389 # set salvable volumes for LDAP data, configuration -VOLUME ["/var/lib/ldap", "/etc/ldap/slapd.d"] +#VOLUME ["/var/lib/ldap", "/etc/ldap/slapd.d"] # set correct permissions for openldap user RUN chown -R openldap:openldap /var/lib/ldap /etc/ldap/slapd.d +# ENTRYPOINT ensures this sh file ALWAYS runs first before any CMD or command line instruction +ENTRYPOINT ["./start-slapd.sh"] + +# CMD provides the default command (/bin/bash) which is passed as an argument to the ENTRYPOINT script +CMD ["/bin/bash"] + ### optional use ### # start slapd #CMD ["slapd", "-h", "ldap:/// ldapi:///", "-g", "openldap", "-u", "openldap", "-F", "/etc/ldap/slapd.d"] @@ -34,4 +44,5 @@ RUN chown -R openldap:openldap /var/lib/ldap /etc/ldap/slapd.d #ENTRYPOINT ["/entrypoint.sh"] #CMD ["bash"] +# //run img container with 'docker run -i -t -v ldap_data:/var/lib/ldap -v ldap_config:/etc/ldap/slapd.d ldapdock' for interactive shell # run img container with 'docker run -i -t -v ldap_data:/var/lib/ldap -v ldap_config:/etc/ldap/slapd.d ldapdock' for interactive shell \ No newline at end of file