-
Notifications
You must be signed in to change notification settings - Fork 879
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
special DNS record for host.docker.internal + gateway.docker.internal #2348
Conversation
Please sign your commits following these rules: $ git clone -b "master" git@github.com:0xbad0c0d3/libnetwork.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -f Amending updates the existing PR. You DO NOT need to open a new one. |
When can we expect it to be merged into |
The way docker does DNS by default is fundamentally broken. It should always use |
Any idea when this will be merged? 🙂 |
When will this nice feature be merged? |
I have been watching this one, we have Linux members on the team that have this record broken which seems bizarre that Windows and Mac would have this record and not Linux |
Dev team is using this one, and when pushing things on production - we are in a great challenging situation. Any anticipated fix date? |
Hello, if you really need a feature like this before it has been merged, you can do something like this. In our Dockerfile, we override the
Be aware, that you need to do this as root user, so the change to a specific user needs to be done within entrypoint.sh (in our Wildfly version via gosu). |
Again, that workaround is known, but not generally practical for complex deployments |
I know that, thats why its called "workaround". But until the final solution is merged and available, it IS a possibility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General advice: if you restrict your PRs to the absolute bare minimum of changes necessary, you increase the chance of being merged. So never reformat any (otherwise untouched) code.
sandbox.go
Outdated
@@ -133,7 +133,8 @@ type containerConfig struct { | |||
} | |||
|
|||
const ( | |||
resolverIPSandbox = "127.0.0.11" | |||
resolverIPSandbox = "127.0.0.11" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The additional space is an unrelated change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This space was produced by gofmt, are you sure it should be as you said?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't matter who or what produced it. It's a change that doesn't belong to the title of this PR. As such, it will distract any reviewers of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If i'll remove it -
🐳 vet
🐳 ineffassign
🐳 fmt
sandbox.go
👹 please format Go code with 'gofmt -s -w'
Makefile:155: recipe for target 'fmt' failed
make: *** [fmt] Error 1
Makefile:114: recipe for target 'check' failed
make: *** [check] Error 2
Exited with code 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another advice, though I don't know whether this applies to docker specifically, but you usually update the pull request, rather than adding more commits that fix the problem in the original pull request.
The reason is to keep the repository history clean and concise.
What I mean, it's better to have a commit that implements the desired functionality (or a logical part of it) without any unrelated changes such as code reformatting, and then another commit that does the reformatting. Rather than having a commit that implements the functionality including unrelated changes, than a commit that reverts the unrelated changes, and finally a commit that adds them back like here.
But to end on a more positive note - I really hope this will get merged soon (whatever version will be accepted by the devs). It's an incredibly useful functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally agree with you about the history and will keep in mind for future
;)
@schildbach, done |
Let’s merge that bad boy! 😛 |
Any day now for this merge! :D |
/cc @arkodg |
@0xbad0c0d3 Sorry about the delayed response. couple of questions/comments :
|
@0xbad0c0d3 have not tried this out but AFAIK this will break Docker Desktop (Mac and Windows) . Today this works on Desktop through a magic proxy called If users were able to insert |
I was thinking about the possibility to manage this feature with cmdline option, but, I am new in go, and do not have time to implement it, more because i could not test it on WIN/MAC systems... But, i think it's easy to detect OS family and apply my "fix" for linux only. Also, i realized that it would not work with docker0 because of the resolv.conf. |
@0xbad0c0d3 |
--add-host is requiring extra work, you have to configure interface first (add alias IP), then modify all your containers to be run with --add-host, or install dnsmasq, configure it...rather than just enjoying the feature "out of the box". |
Signed-off-by: Daniil Skomarovskiy <0xbad0c0d3@gmail.com>
Signed-off-by: Daniil Skomarovskiy <0xbad0c0d3@gmail.com>
Signed-off-by: Daniil Skomarovskiy <0xbad0c0d3@gmail.com>
Signed-off-by: Daniil Skomarovskiy <0xbad0c0d3@gmail.com>
… - gofmt Signed-off-by: Daniil Skomarovskiy <0xbad0c0d3@gmail.com>
Signed-off-by: Daniil Skomarovskiy <0xbad0c0d3@gmail.com>
@arkodg I've implemented trough |
@0xbad0c0d3 according to https://docs.docker.com/v17.09/engine/userguide/networking/default_network/configure-dns/ |
I can't understand, why this request is not merged. For us in an agency, we need a workaround for linux. Otherwise for WIndows or OSX, but this is the regular thing. There are round abound more than 400 "likes" for this feature and there is nothing technical, why this can not merged. So please merge this request. |
@arkodg Generally - you are right, but in other way it requires another PR directly to docker engine, or I am wrong? |
@0xbad0c0d3 I think this issue can be solved completely in |
@0xbad0c0d3 thanks for highlighting this issue, I've raised a similar PR in
|
Any idea when this will be merged? |
need this, please add it |
MERGE MERGE MERGE! |
Looks like it will take another 3-4 months to actually solve all the dependency problems |
FYI for people who have been watching this like a hawk, dialogue has been going on here between members of the Moby team: moby/moby#40007 |
is this scheduled? |
@0xbad0c0d3 can you please close this PR in favor of moby/moby#40007 |
In brief: for who came here looking for how to be able to use this is needed in your docker-compose: in the service definition:
Then, from your container your should be able to ping the host.
This should be working from Docker v. 20.10. Thanks to everyone who worked on fixing it and who researched for solutions! 🙏☀️❤️ |
I was not able to find "magic" for mac and windows systems about 'host.docker.internal' and all solutions in the Net just workarounds. Here I am with my solution... Maybe it's not the best, but it works just fine.
Yes, this functionality can be implemented with dnsmasq, but not everyone can do it by themselves. That's why i find this PR useful