Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

create minimal nsswitch.conf file in Docker image #1630

Merged
merged 1 commit into from
Jan 8, 2019

Conversation

2opremio
Copy link
Contributor

@2opremio 2opremio commented Jan 3, 2019

As a result, /etc/hosts will be prioritized over DNS queries

This resolves the conflict between:

Fixes #1627

As a result, /etc/hosts will be prioritized over DNS queries

This resolves the conflict between:
 * fluxd using netgo for static compilation. netgo reads nsswitch.conf to mimic glibc,
   defaulting to prioritize DNS queries over /etc/hosts if nsswitch.conf is missing:
   golang/go#22846
 * Alpine not including a nsswitch.conf file. Since Alpine doesn't use glibc
   (it uses musl), maintainers argue that the need of nsswitch.conf is a Go bug:
   gliderlabs/docker-alpine#367 (comment)
# * Alpine not including a nsswitch.conf file. Since Alpine doesn't use glibc
# (it uses musl), maintainers argue that the need of nsswitch.conf is a Go bug:
# https://github.com/gliderlabs/docker-alpine/issues/367#issuecomment-354316460
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would write out the entire file as it is, and make this a COPY ./nsswitch.conf /etc/nsswitch.conf. Given the context, I doubt it would eventually appear in the Alpine image.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a fair point; on the other hand it doesn't hurt to be careful.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imho the current one-liner is great; I doubt we will ever make changes to the nsswitch.conf content so there is no reason to maintain a separate file to ease modifications.

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.

Flux not honouring /etc/hosts file
4 participants