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

标签 linux docker

我有一台带有两个 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/

相关文章:

c - 如何使用 clock_gettime 制作精确的倒数计时器?

java - 使用 jna 调用 ioctl 系统调用

java - android 中的 'strace'

docker - 如何在Centos的生产环境中运行docker容器?

docker - 为docker和compose文件指定端口

python - 如何使用 python 获取程序 PID

c - 如何转储页表?

docker "Couldn' t 找到一个替代的 telinit 实现来生成”

docker - 如何从 Docker Hub 获取 "docker-compose up"图像

ruby-on-rails - 配置 docker 卷以跨主机和容器共享数据