【问题标题】:docker port forward bind/dns/udp not responddocker 端口转发绑定/dns/udp 无响应
【发布时间】:2016-01-13 06:32:56
【问题描述】:

除了 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

虚拟框外

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

有什么问题?

【问题讨论】:

    标签: docker udp bind portforwarding


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2013-06-24
      • 1970-01-01
      • 2023-03-03
      • 1970-01-01
      • 2015-02-24
      • 2015-02-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多