简体   繁体   English

为什么 Docker 会阻止将容器附加到主机和用户定义的桥接网络?

[英]Why does Docker prevent attaching a container to both host and user defined bridge network?

Why is it that Docker prohibits attaching a container to both the host and user defined bridge network?为什么 Docker 禁止将容器附加到主机和用户定义的桥接网络?

Secondly, for deployments that require disabling IP forwarding on the host machine does docker recommend deploying docker containers with host networking only, since based on what i understand that seems to be the only option left.其次,对于需要在主机上禁用 IP 转发的部署,docker 是否建议仅使用主机网络部署 docker 容器,因为根据我的理解,这似乎是唯一的选择。

Any insights on the above two?对以上两个有什么见解吗?

Thanks谢谢

Why is it that Docker prohibits attaching a container to both the host and user defined bridge network?为什么 Docker 禁止将容器附加到主机和用户定义的桥接网络?

Because there's no way to "attach" networks when a container is running in the host network namespace.因为当容器在主机网络命名空间中运行时,无法“附加”网络。

Docker attaches networks by adding virtual interfaces to a container's isolated network namespace. Docker 通过将虚拟接口添加到容器的隔离网络命名空间来连接网络。 When running in the global network namespace, there's no sane way to do this: any new interfaces wouldn't be restricted to the container, and would potentially disrupt host networking.在全局网络命名空间中运行时,没有明智的方法来做到这一点:任何新接口都不会被限制在容器中,并且可能会破坏主机网络。

Secondly, for deployments that require disabling IP forwarding on the host machine does docker recommend deploying docker containers with host networking only, since based on what i understand that seems to be the only option left.其次,对于需要在主机上禁用 IP 转发的部署,docker 是否建议仅使用主机网络部署 docker 容器,因为根据我的理解,这似乎是唯一的选择。

That's probably the only easy option.这可能是唯一简单的选择。

You could run a proxy service on the host that would expose services in Docker containers.您可以在主机上运行代理服务,该服务将在 Docker 容器中公开服务。 You could potentially even automate that by monitoring the Docker for events and getting information about published ports.您甚至可以通过监视 Docker 的事件并获取有关已发布端口的信息来实现自动化。 Otherwise you would need to manually implement the appropriate configuration.否则,您将需要手动实施适当的配置。

暂无
暂无

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

相关问题 docker 主机和容器中的网络设置使用用户定义的桥接网络,其中从主机到容器的 ping 失败 - Network setting in docker host and container using user defined bridge network, where ping fails from host to container Docker Compose 同时使用主机和桥接网络 - Docker Compose use both host and bridge network docker 用户定义的桥接网络是否支持多播? - Does docker user defined bridge network support multicast? 为什么 docker 应用程序与主机网络一起工作,但与桥接网络无关? - Why docker application is working with host network but not with bridge network? Docker 容器不与同一个 docker 网络(网桥)中的其他人通信 - Docker container does not communicate with others in same docker network(bridge) Docker Bridge 与主机网络冲突 - Docker Bridge Conflicts with Host Network Docker用户定义的网络-通过容器主机名进行容器间通信 - Docker User-defined Network - Inter-Container Communication via Container Host Name 查询生活在网桥用户定义网络中的docker mysql - query a docker mysql living in a bridge user defined network 无法连接到 Docker 用户定义的桥接网络 - Can't connect to Docker user defined bridge network 为什么 docker 容器无法通过默认网络名称中的容器名称相互 ping 通,如网桥和驱动程序网桥 - Why docker containers are not pingable to each other through container name in the default network name as bridge and driver bridge
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM