pebble
pebble copied to clipboard
Proposal: Add /etc/nsswitch.conf to image to enable usage of /etc/hosts file
As Go ignores /etc/hosts
if no /etc/nsswitch.conf
is present, name resolution using the hosts file is impossible. To make matters worse, the Go binary of pebble seems to read those files only once. So even if I create /etc/nsswitch.conf
after starting the container, the settings aren't used and restarting the container resets the filesystem and effectively removes /etc/nsswitch.conf
.
My proposal would be to use the same "fix" for this that Go uses, see here:
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
This issue was debated over at the Golang Github repo and the default value will change in due time, but until this happens it would be nice to have a fix.
I'd be happy to create a PR for this.
This was resolved with Go 1.16 (released in Feb 2021).
If you need more info / proof that it's no longer necessary, see this comment.
That said, the Alpine image used should probably be updated (not that you need the /etc/nsswitch.conf
that's now included since Alpine 3.16.3):
https://github.com/letsencrypt/pebble/blob/66511d84d07f8bffc6016cde6434bb850d68e062/docker/pebble/linux.Dockerfile#L11