docker 端口转发 bind/dns/udp 没有响应
docker port forward bind/dns/udp not respond
除了 docker 容器特定的 ip 或容器内部,我无法从任何地方获得响应。
我的防火墙在 virtualbox 机器上被禁用:
root@docker-aasaam-web-app:~# ufw status verbose
Status: inactive
在docker机器测试docker容器ip:
root@docker-machine:~# telnet 172.17.0.3 53
Trying 172.17.0.3...
Connected to 172.17.0.3.
Escape character is '^]'.
^]
telnet> q
Connection closed.
容器内
root@014f546c2322:/# telnet 127.0.0.1 53
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
在docker机器上测试本地ip:
root@docker-machine:~# telnet 127.0.0.1 53
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
virtualbox 之外
sweb@sweb-laptop:~$ ping 192.168.56.160
PING 192.168.56.160 (192.168.56.160) 56(84) bytes of data.
64 bytes from 192.168.56.160: icmp_seq=1 ttl=64 time=0.366 ms
^C
--- 192.168.56.160 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.366/0.366/0.366/0.000 ms
sweb@sweb-laptop:~$ telnet 192.168.56.160 53
Trying 192.168.56.160...
telnet: Unable to connect to remote host: Connection refused
和docker ps是:
root@docker-machine:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dc758771ce15 exampleapp-dns:latest "exampleapp-start" 21 minutes ago Up 21 minutes 0.0.0.0:53->53/udp exampleapp-dns
有什么问题?
已解决。我需要将 --dns=127.0.0.1
添加到 运行 容器以进行强制解析配置。
除了 docker 容器特定的 ip 或容器内部,我无法从任何地方获得响应。
我的防火墙在 virtualbox 机器上被禁用:
root@docker-aasaam-web-app:~# ufw status verbose
Status: inactive
在docker机器测试docker容器ip:
root@docker-machine:~# telnet 172.17.0.3 53
Trying 172.17.0.3...
Connected to 172.17.0.3.
Escape character is '^]'.
^]
telnet> q
Connection closed.
容器内
root@014f546c2322:/# telnet 127.0.0.1 53
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
在docker机器上测试本地ip:
root@docker-machine:~# telnet 127.0.0.1 53
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
virtualbox 之外
sweb@sweb-laptop:~$ ping 192.168.56.160
PING 192.168.56.160 (192.168.56.160) 56(84) bytes of data.
64 bytes from 192.168.56.160: icmp_seq=1 ttl=64 time=0.366 ms
^C
--- 192.168.56.160 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.366/0.366/0.366/0.000 ms
sweb@sweb-laptop:~$ telnet 192.168.56.160 53
Trying 192.168.56.160...
telnet: Unable to connect to remote host: Connection refused
和docker ps是:
root@docker-machine:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dc758771ce15 exampleapp-dns:latest "exampleapp-start" 21 minutes ago Up 21 minutes 0.0.0.0:53->53/udp exampleapp-dns
有什么问题?
已解决。我需要将 --dns=127.0.0.1
添加到 运行 容器以进行强制解析配置。