Update dockerfile

This commit is contained in:
Marisa 2025-10-26 14:52:28 -04:00
parent 2a4d5156c9
commit a83c87f270

View File

@ -17,15 +17,25 @@ RUN echo "slapd slapd/password1 password admin" | debconf-set-selections && \
# make use of debconf-set-selections # make use of debconf-set-selections
RUN dpkg-reconfigure -f noninteractive slapd 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 # open up LDAP simple port
EXPOSE 389 EXPOSE 389
# set salvable volumes for LDAP data, configuration # 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 # set correct permissions for openldap user
RUN chown -R openldap:openldap /var/lib/ldap /etc/ldap/slapd.d 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 ### ### optional use ###
# start slapd # start slapd
#CMD ["slapd", "-h", "ldap:/// ldapi:///", "-g", "openldap", "-u", "openldap", "-F", "/etc/ldap/slapd.d"] #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"] #ENTRYPOINT ["/entrypoint.sh"]
#CMD ["bash"] #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 # 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