[英]Can't ping host network by name from Docker bridged container
06.1-ce 06.1-ce
I have a container running in bridge newtork 我有一个在newtork桥中运行的容器
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"
}
]
}
I can access my containers no problem, but I need to connect to a machine on the host network. 我可以毫无问题地访问我的容器,但是我需要连接到主机网络上的计算机。 When I docker exec -ti bash inside the container, I can ping by IP but not by name. 当我在容器内执行docker exec -ti bash时,我可以按IP ping但不能按名称ping。 Is that how Docker bridge network works? Docker网桥网络是这样工作的吗?
Update 更新资料
I can ping by full name. 我可以按全名来ping。 So is there a way to set the search domain for containers? 那么有没有办法为容器设置搜索域?
Ok we can set the DNS settings when using docker run 好的,我们可以在使用docker run时设置DNS设置
such as: --dns-search=mydomain.com 例如:--dns-search = mydomain.com
https://docs.docker.com/engine/userguide/networking/default_network/configure-dns/ https://docs.docker.com/engine/userguide/networking/default_network/configure-dns/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.