Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

Add nsswitch.conf file into the image #42

Closed
wants to merge 2 commits into from

Conversation

mprasil
Copy link

@mprasil mprasil commented Nov 23, 2018

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
Copy link
Contributor

Hi @mprasil , thanks for this proposal.

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

It means:

  • Removing the nsswitch.conf files (and the related COPY/ADD instructions from the PR
  • Adapting the tmpl.Dockerfile with the RUN instruction for the nsswitch.

@mprasil
Copy link
Author

mprasil commented Jun 7, 2019

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

@mprasil
Copy link
Author

mprasil commented Jun 27, 2019

Resolved merge conflict.

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

Successfully merging this pull request may close these issues.

2 participants