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
Fixes #275 : use host dns with slirp4netns support in rootless mode #374
Conversation
7b60759
to
44530b0
Compare
…ess mode Signed-off-by: Francois JACQUES <fjacques@murex.com>
|
||
// Package resolvconf provides utility code to query and update DNS configuration in /etc/resolv.conf | ||
// originally from https://github.com/moby/moby/blob/6014c1e29dc34dffa77fb5749cc3281c1b4854ac/libnetwork/resolvconf/resolvconf.go | ||
package resolvconf |
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.
thanks, if you have used functions from moby or other, please put the reference to the original function
example
Line 57 in 10a62bd
// eventsActions is from https://github.com/containerd/containerd/blob/v1.4.3/cmd/ctr/commands/events/events.go |
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.
I copied the whole file. Should I put the comment on top of each function ?
if err != nil { | ||
return err | ||
} | ||
} |
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.
Thanks for working on this, but I guess we do not need to detect the slirp4netns DNS.
We can just use /etc/resolv.conf
(/run/systemd/resolve/resolv.conf
) for both rootful and rootless.
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.
Indeed, in case of rootless we run in the mount ns of rootlesskit thus having the /etc/resolv.conf containing the slirp dns right ?
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.
Hmm, I guess we can merge this right now and revisit later.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ |
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.
Probably better to show Docker/Moby copyrights too.
Like this:
nerdctl/pkg/inspecttypes/dockercompat/dockercompat.go
Lines 17 to 21 in f6f48cd
/* | |
Portions from https://github.com/moby/moby/blob/v20.10.1/api/types/types.go | |
Copyright (C) Docker/Moby authors. | |
Licensed under the Apache License, Version 2.0 | |
*/ |
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.
Thanks
This is a first draft written this afternoon. I need to test it more.
In rootless and rootful mode, parse host resolv.conf the 'docker' way : if non-local DNS are found, use them. If no non-local DNS is found, use default google DNS servers. In case DNS is 127.0.0.53, parse an alternative resolv file.
In rootless mode, add the slirp4netns dns as 1st nameserver