I'm trying to set up a standalone DNSFTL binary in a Docker scratch container. I've copied the required libraries in and mounted the required configs. DNSFTL does load up, but I'm getting an error:
dnsmasq: unknown user or group: scus
My Docker file:
FROM alpine:latest
RUN adduser --disabled-password --no-create-home scus scus
FROM scratch
COPY pihole-FTL /
COPY . /
COPY --from=0 /etc/passwd /etc/passwd
COPY --from=0 /etc/group /etc/group
USER scus
ENTRYPOINT ["/pihole-FTL"]
My dnsmasq.conf
:
port=5555
user=scus
group=scus
The passwd
and group
files are present in container.
When I switch the image to Ubuntu or Debian FTLDNS loads up correctly.
I've narrowed down the dnsmasq code to this section in dnsmasq.c
:
if (daemon->username && !(ent_pw = getpwnam(daemon->username)))
baduser = daemon->username;
else if (daemon->groupname && !(gp = getgrnam(daemon->groupname)))
baduser = daemon->groupname;
if (baduser)
die(_("unknown user or group: %s"), baduser, EC_BADCONF);
Only thing I can think of is whether the functions getpwnam
and getgrnam
aren't functioning correctly with the copied passwd
and group
files. I understand Docker base images to just contain files from the particular OS so it shouldn't affect system calls?
I've really no idea how I can sort this. I don't want to modify the code because I need to be able to reliably update the binary.
Would greatly appreciate any help on this. Thanks.