mirror of
https://github.com/containers/podman.git
synced 2025-08-06 03:19:52 +08:00
podman: relay custom DNS servers to network stack
Aardvark-dns and netavark now accepts custom DNS servers for containers via new config field `dns_servers`. New field allows containers to use custom resolvers instead of host's default resolvers. Following commit instruments libpod to pass these custom DNS servers set via `--dns` or central config to the network stack. Depends-on: * Common: containers/common#1189 * Netavark: containers/netavark#452 * Aardvark-dns: containers/aardvark-dns#240 Signed-off-by: Aditya R <arajan@redhat.com>
This commit is contained in:
@ -39,9 +39,15 @@ func (c *Container) convertPortMappings() []types.PortMapping {
|
||||
}
|
||||
|
||||
func (c *Container) getNetworkOptions(networkOpts map[string]types.PerNetworkOptions) types.NetworkOptions {
|
||||
nameservers := make([]string, 0, len(c.runtime.config.Containers.DNSServers)+len(c.config.DNSServer))
|
||||
nameservers = append(nameservers, c.runtime.config.Containers.DNSServers...)
|
||||
for _, ip := range c.config.DNSServer {
|
||||
nameservers = append(nameservers, ip.String())
|
||||
}
|
||||
opts := types.NetworkOptions{
|
||||
ContainerID: c.config.ID,
|
||||
ContainerName: getNetworkPodName(c),
|
||||
DNSServers: nameservers,
|
||||
}
|
||||
opts.PortMappings = c.convertPortMappings()
|
||||
|
||||
|
Reference in New Issue
Block a user