Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Add /etc/nsswitch.conf to image to enable usage of /etc/hosts file #366

Closed
Schrottfresse opened this issue Oct 22, 2021 · 1 comment

Comments

@Schrottfresse
Copy link

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.

@polarathene
Copy link

polarathene commented Dec 28, 2023

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):

FROM alpine:3.15.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants