docker port forward bind / dns / udp无响应

时间:2016-01-13 06:32:56

标签: docker udp bind portforwarding

除了docker容器特定的ip或容器内部之外,我无法得到响应。

我的防火墙在虚拟机机器上被禁用:

root@docker-aasaam-web-app:~# ufw status verbose
Status: inactive

在docker机器上测试docker container 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

问题是什么?

1 个答案:

答案 0 :(得分:2)

解决。我需要将--dns=127.0.0.1添加到正在运行的容器中以强制解析配置。