亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Docker for Mac 創(chuàng)建的dnsmasq容器連不上/不工作的問題
淡淡煙草味
淡淡煙草味 2017-04-24 15:59:22
0
1
987

在使用docker for mac構(gòu)建了一個dnsmasq的Container, 但是發(fā)現(xiàn)53端口似乎無法連接, 使用dig各種超時

這是dockerfile

FROM centos:6.8

RUN yum update -y && yum install -y dnsmasq

RUN echo "listen-address=0.0.0.0" > /etc/dnsmasq.conf
RUN echo "conf-dir=/etc/dnsmasq.d" >> /etc/dnsmasq.conf
RUN echo "user=root" >> /etc/dnsmasq.conf
RUN echo "server=/a/127.0.0.1" >> /etc/dnsmasq.conf
#a供測試用

#RUN echo 'resolv-file=/etc/resolv.dnsmasq.conf' >> /etc/dnsmasq.conf
#RUN echo "nameserver 127.0.0.11" > /etc/resolv.dnsmasq.conf
#上一行出現(xiàn)了127.0.0.11并不是寫錯, 而是發(fā)現(xiàn)docker for mac的container的/etc/resolv.conf里面確實出現(xiàn)了127.0.0.11, 并且這個上面是可以解析域名的, 所以才試圖這么嘗試過這個配置

RUN yum install nc -y

RUN yum clean all

EXPOSE 53
EXPOSE 53/udp

#CMD ["nc", "-l",  "53"] #tcp調(diào)試
#CMD ["nc", "-l", "-u",  "53"] #udp調(diào)試

CMD ["/usr/sbin/dnsmasq", "-d"]

這是docker-compose

version: '2'

services:
    dns:
        build: ../../images/dnsmasq
        container_name: dns
        restart: always
        #env_file: ./config/.env
#        volumes:
#            - /etc/hosts:/etc/hosts
#        dns:
#            - 127.0.0.1
        ports:
            - "53:53"
            - "53:53/udp"

各種端口映射應(yīng)該是沒有問題的, 宿主機上運行和訪問:

容器內(nèi)運行和訪問:

淡淡煙草味
淡淡煙草味

reply all(1)
僅有的幸福

After @Youming’s suggestion, the fundamental problem is that there is a problem with the configuration of dnsmasq rather than a problem with docker. There are the following points:

  1. Wrong server=/a/127.0.0.1 當(dāng)成了 address=/a/127.0.0.1

  2. dnsmasq of listen-address=0.0.0.0 似乎是有bug的, 必須listen到精確的網(wǎng)卡的IP地址或者干脆不要這行listen-address

After changing it, it will work normally

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template