gpt4 book ai didi

linux - docker 实例可以只连接到一个特定的网络接口(interface)吗?

转载 作者:太空狗 更新时间:2023-10-29 11:13:02 25 4
gpt4 key购买 nike

我有一台带有两个 NIC 的服务器,一个用于其他服务器之间的专用 LAN(我们称之为 eth1),另一个用于公共(public)网络(我们称之为 eth0)。

我在服务器上设置了一个 docker 实例,供客户端托管网站。是否可以仅使用 eth0 路由网络流量出/入?我不希望客户端能够访问私有(private)局域网。

如果这不可能,是否有其他解决方案?

最佳答案

考虑到隔离的类型,这应该是可能的 docker network应该带。你甚至可以 define your own network .

通过使用 eth0 在服务器上创建的桥接网络,您可以仅使用该网络定义容器:

docker network create --driver bridge isolated_nw
docker run --net=isolated_nw -itd --name=container3 busybox

The containers you launch into this network must reside on the same Docker host. Each container in the network can immediately communicate with other containers in the network. Though, the network itself isolates the containers from external networks.

http://docs.docker.com/engine/userguide/networking/images/bridge_network.png

关于linux - docker 实例可以只连接到一个特定的网络接口(interface)吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33763119/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com