(apologies to the list, I'm going to engage on a couple of docker points here while addressing the actual -- fairly Debian specific -- question; feel free to skip over this mail...)
On Thu, Jun 18, 2020 at 06:43:37PM +0200, darkdragon wrote:
# systemd RUN apt-get update && apt-get install -y \ systemd systemd-sysv && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* RUN systemctl disable systemd-resolved.service RUN systemctl disable systemd-hostnamed.service
systemd in a container? I'll assume you know what you're doing, but it looks to me like a weird thing to do. At any rate it would help if you could reduce this to just the parts relevant for the actual problem.
# Allow restart of slapd after dpkg-reconfigure (docker forbids this by default) RUN bash -c "install -m755 <(printf '#!/bin/sh\nexit 0') /usr/sbin/policy-rc.d"
docker doesn't care. this policy comes from the debian:buster container, which (IMO rightly) assumes that you will run your daemon directly and not via the service manager.
My goal is to set the domain to "thisbox".
OK, that's a good thing to have stated up front.
Running the following code (within container):
cat <<EOF >/tmp/slapd Name: slapd/domain Template: slapd/domain Value: thisbox Owners: slapd EOF DEBIAN_FRONTEND=noninteractive DEBCONF_DB_OVERRIDE=/tmp/slapd dpkg-reconfigure slapd
I'd recommend preseeding the config before installing slapd, instead of trying to make dpkg-reconfigure work in the container.
example of a Dockerfile for that:
FROM debian:buster
ENV DEBIAN_FRONTEND=noninteractive
RUN echo slapd slapd/domain string thisbox | debconf-set-selections && \ apt-get update && \ apt-get -y install ldap-utils slapd && \ apt-get clean
ENTRYPOINT ["/usr/sbin/slapd", "-h", "ldap:/// ldapi:///", "-u", "openldap", "-d", "0"]
Pre-configuring 'slapd/domain' to 'thisbox' will initialize it with the suffix set to 'dc=thisbox'. The slapd package offers a few other debconf settings for things like the admin password, too.
Hope that helps.