DNS do Host não funciona com o contêiner docker

Eu tenho um problema com o docker no meu kernel archlinux Linux 4.19.31-1-lts #1 SMP Sun Mar 24 09:29:16 CET 2019 x86_64 GNU/Linux

$ docker info retornar :

$ docker info                                                                                                                                                                       Containers: 46 Running: 0 Paused: 0 Stopped: 46Images: 1Server Version: 18.09.3-ceStorage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: falseLogging Driver: json-fileCgroup Driver: cgroupfsPlugins: Volume: local Network: bridge host macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslogSwarm: inactiveRuntimes: runcDefault Runtime: runcInit Binary: docker-initcontainerd version: bb71b10fd8f58240ca47fbb579b9d1028eea7c84.mrunc version: ccb5efd37fb7c86364786e9137e22948751de7ed-dirtyinit version: fec3683Security Options: seccomp  Profile: defaultKernel Version: 4.19.31-1-ltsOperating System: Arch LinuxOSType: linuxArchitecture: x86_64CPUs: 4Total Memory: 15.54GiBName: kermipcID: 5HFD:A2HY:5RBD:OK2D:OQ2R:KQFY:AW6F:MNES:CAX4:O2NC:2NXO:OOGXDocker Root Dir: /var/lib/dockerDebug Mode (client): falseDebug Mode (server): falseRegistry: https://index.docker.io/v1/Labels:Experimental: falseInsecure Registries: 127.0.0.0/8Live Restore Enabled: false

$ ip a parece :

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00    inet 127.0.0.1/8 scope host lo       valid_lft forever preferred_lft forever    inet6 ::1/128 scope host        valid_lft forever preferred_lft forever2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000    link/ether 38:2c:4a:be:1d:d0 brd ff:ff:ff:ff:ff:ff    inet 192.168.1.10/24 brd 192.168.1.255 scope global dynamic noprefixroute enp3s0       valid_lft 82509sec preferred_lft 82509sec    inet6 2a01:cb1c:556:7f00:39c4:7c42:ae64:a6d4/64 scope global dynamic mngtmpaddr noprefixroute        valid_lft 1749sec preferred_lft 549sec    inet6 fe80::3a2c:4aff:febe:1dd0/64 scope link noprefixroute        valid_lft forever preferred_lft forever66: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default     link/ether 02:42:db:68:f0:17 brd ff:ff:ff:ff:ff:ff    inet 172.18.0.1/16 brd 172.17.255.255 scope global docker0       valid_lft forever preferred_lft forever

Docker está corretamente em Ponte :

$ docker run alpine ping 8.8.8.8                                                                                                                                                           PING 8.8.8.8 (8.8.8.8): 56 data bytes64 bytes from 8.8.8.8: seq=0 ttl=119 time=2.012 ms64 bytes from 8.8.8.8: seq=1 ttl=119 time=1.910 ms64 bytes from 8.8.8.8: seq=2 ttl=119 time=5.877 ms^C--- 8.8.8.8 ping statistics ---3 packets transmitted, 3 packets received, 0% packet lossround-trip min/avg/max = 1.910/3.266/5.877 ms

Mas o dns não está funcionando :

$ docker run alpine ping google.com                                                                                                                                                        ping: bad address 'google.com'

/etc/dnsmasq.conf parece :

address=/local.lan/127.0.0.1user=nobodygroup=nobodyno-dhcp-interface=# listen-address=127.0.0.1,172.18.0.1interface=lointerface=docker0bind-interfaceslog-dhcplog-querieslog-facility=/var/log/dnsmasq.log

/etc/resolv.conf parece :

#Generated by NetworkManagersearch 8.8.4.4nameserver 192.168.1.1nameserver 127.0.0.1nameserver 172.18.0.1

Quando eu faço um docker run alpine ping google.com eu posso ver com o arquivo de log que dnsmasq correcty resolve dns.Alguma ideia ?

Editar 1 :

docker run --rm -it alpine cat /etc/resolv.conf dizer :

# Generated by NetworkManagersearch 8.8.4.4nameserver 192.168.1.1nameserver 172.18.0.1

Parece que você esqueceu de configurar o IPv6 na rede Docker.

Você está Certo, Todos os meus problemas desapareceram, a solução é :

Em /etc/dhcpcd.conf remover ou comentar :

noipv4ll

Em seguida, reinicie o docker :

sudo systemctl restart docker

Parece que você esqueceu de configurar o IPv6 na rede Docker.

Pesquisei no Google, mas não encontro nada, por favor, você pode me dizer mais ?

Se você o que faz o seu ’ /etc / resolv.conf ’ Parece dentro de um recipiente alpino? 'docker run – rm-it alpine cat / etc / resolv.conf`