简体   繁体   English

Docker 容器无法解析 docker 主机可以解析的互联网主机

[英]Docker container unable to resolve internet host that docker host can resolve

This confuses me as it's just started happening...这让我感到困惑,因为它刚刚开始发生......

My workstation (Ubuntu 18.04 running docker 20.10.17) can resolve a specific internet host without issue.我的工作站(运行 docker 20.10.17 的 Ubuntu 18.04)可以毫无问题地解析特定的 Internet 主机。 The container that my workstation hosts, however, is unable to resolve the same host.但是,我的工作站托管的容器无法解析同一主机。

docker容器,然后host,解析同一个在线host

Any other internet host appears to resolve without any issue within the container: actually, from what I can see, it's unable to resolve any host assigned to that specific domain name (eg flora.com) but only in the container - on the host it's just fine.任何其他互联网主机似乎都可以在容器内解决而没有任何问题:实际上,据我所知,它无法解析分配给该特定域名(例如flora.com)的任何主机,但只能在容器中 - 在它所在的主机上正好。

I've read that docker takes a copy of /etc/resolv.conf from the host and places it into the container, but I don't think that's correct as my container's /etc/resolv.conf reads as follows:我读过 docker 从主机获取/etc/resolv.conf的副本并将其放入容器中,但我认为这是不正确的,因为我的容器的/etc/resolv.conf如下所示:

search lan
nameserver 127.0.0.11
options edns0 ndots:0

whereas my workstation's /etc/resolv.conf read:而我的工作站的/etc/resolv.conf读取:

# This file is managed by man:systemd-resolved(8). Do not edit.
...
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
options edns0
search lan

Within my docker-compose.yml I have my containers using a defined bridged network (which has been working just fine for the last three years):在我的docker-compose.yml中,我的容器使用定义的桥接网络(过去三年一直运行良好):

  console-vpacs:
    ...
    depends_on: [console-mysql]
    ...
    networks:
      - dev-vlt-console
...
networks:
  dev-vlt-console:
    name: dev-vlt-console
    driver: bridge

I'm at a bit of a loss where to go from here as I've:我有点不知所措,因为我从这里到 go:

  1. restarted the docker service a number of time多次重启 docker 服务
  2. deleted the docker0 interface, restarted the service删除docker0接口,重启服务
  3. searched SO and google and nothing appears to be working (the only thing I've not done is to remove docker and reinstall)搜索了 SO 和谷歌,似乎没有任何工作(我唯一没有做的是删除 docker 并重新安装)

Can anyone give any insight?任何人都可以提供任何见解吗?

A complete reinstall of docker resolved this issue.完全重新安装 docker 解决了这个问题。 Very odd that it happened, but I'm still running 20.10.17 so there was no update there... but I'm back up and running again很奇怪,它发生了,但我仍在运行 20.10.17 所以那里没有更新......但我又恢复运行了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM