Skip to content

Add nsswitch.conf to Minecraft docker image to fix localhost resolution #307

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

Closed
notgne2 opened this issue Apr 20, 2019 · 6 comments
Closed
Labels
status/waiting on feedback Waiting on feedback from author of issue

Comments

@notgne2
Copy link

notgne2 commented Apr 20, 2019

There is the related issue here golang/go#22846

rcon-cli uses Go, which will resolve localhost incorrectly on certain machines, this could be fixed by creating a basic nsswitch.conf, echo 'hosts: files dns' > /etc/nsswitch.conf should do

@itzg
Copy link
Owner

itzg commented Apr 22, 2019

Is there a particular way you are running the docker container or the daemon that causes that issue for you? I have never encountered localhost not resolving within the container.

@notgne2
Copy link
Author

notgne2 commented Apr 24, 2019

I think it may depend on the actual network configuration of the network the host machine uses, as unless I am missing something, this issue results in the go DNS resolving skipping resolution using /etc/hosts.

It has had issues on 4 out of 5 CentOS 7 hosts I have tried it on, with identical docker configurations, and have been working around in the meantime by adding GODEBUG=netdns=cgo to env.

@itzg
Copy link
Owner

itzg commented Apr 29, 2019

I'll work on adding this change sometime today, but I'll need you to verify the fix since I am not able to recreate it and have heard no other reports of this. I was quite confident the addition of nsswitch.conf will fix it; however, this comment of the issue worries me since the minecraft server image is based on Alpine.

itzg added a commit that referenced this issue Apr 30, 2019
@itzg
Copy link
Owner

itzg commented Apr 30, 2019

This change has been pushed to Docker Hub. @notgne2 , can you see if this resolved the issue for you?

@itzg itzg added the status/waiting on feedback Waiting on feedback from author of issue label Apr 30, 2019
@notgne2
Copy link
Author

notgne2 commented May 1, 2019

I think that issue is just referring to Alpine being one of the few images lacking nsswitch.conf by default and that's why Go are urged to fix it internally, I'll give this a test later today if I get the time.

@notgne2
Copy link
Author

notgne2 commented May 2, 2019

Tested on one of the problematic servers without the workaround env supplied, no errors in logs and docker exec -it mc rcon-cli connects just fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/waiting on feedback Waiting on feedback from author of issue
Projects
None yet
Development

No branches or pull requests

2 participants