nerdctl
nerdctl copied to clipboard
Proposal: Change the DNS impl for the nerdctl network
What is the problem you're trying to solve
For now, the nerdctl uses the /etc/hosts
file to record the DNS for the different containers.
But in some circumstances, we need to maintain the different hosts file for different containers (add a record when a container create successfully, delete a record when a container delete successfully)
If the file is not right, there should be some DNS issues for the user, such as #1149
So maybe we need to use a better way to record the DNS.
Describe the solution you'd like
Maybe we can use dnsname as a reference.
The dnsname makes a CNI plugin to record the DNS item. It allocates a dnsmasq process for each network. I think it's a good example for us.
cc @AkihiroSuda @junnplus @fahedouch
Additional context
No response
@AkihiroSuda would you mind helping me to add a label kind/proposal
for this project?
SGTM, I think it is a good idea to delegate dns recording to the dnsmasq rather than nerdctl
SGTM as an opt-in.
The default should remain files, as dnsname
is not a part of https://github.com/containernetworking/plugins
The default should remain files, as
dnsname
is not a part of https://github.com/containernetworking/plugins
Yes, the people can choose DNS engine theirself
Please let me know if I'm hitting this limitation or a different one:
When running nginx using docker, the correct way to use the resolver command is to pass it the ip of the Docker DNS resolver, 127.0.0.11
When running nginx using docker, nerdctl-provided DNS resolver (whatever it writes in /etc/resolv.conf, 172.17.32.21 in my case) can only resolve external names, and any names on the nerdctl network are hardcoded in /etc/hosts only, so nginx cannot resolve them.