containous / traefik-library-image

ARCHIVED
https://github.com/traefik/traefik-library-image
Apache License 2.0
218 stars 60 forks source link

Add nsswitch.conf file into the image #42

Closed mprasil closed 4 years ago

mprasil commented 5 years ago

This fixes an issue I've encountered - the absence of /etc/nsswitch.conf makes traefik ignore the /etc/hosts file inside the container. For reference see here and here for alpine.

This is very surprising and often painful in some scenarios like this one. But I suppose any user that is trying to use --add-host docker flag in lieu of DNS entry for whatever reason is going to be burned by that.

The nsswitch.conf file added is default configuration found in most distributions I've seen. I've used it for completeness as that's the one distroless base image is using, but just having this one line in would alleviate the specific problem:

hosts:          files dns

I can modify the PR if you prefer that format.

Hope that helps.

dduportal commented 5 years ago

Hi @mprasil , thanks for this proposal.

Could you update this PR to fit https://github.com/gliderlabs/docker-alpine/issues/367#issuecomment-424546457 (tianon being a maintainer/reviewer of the official Docker Library, his fix sounds like a solid pattern for the reviews)?

It means:

mprasil commented 5 years ago

Hi @dduportal, I've updated the PR and rebased on top of current master. Hopefully it's better now.

mprasil commented 5 years ago

Resolved merge conflict.