Is it possible to isolate docker container in user-defined overlay network from outside internet?

泪湿孤枕 提交于 2019-12-24 20:33:19

问题


With new network feature in docker 1.10 it is possible to create isolated overlay networks - which works very well. Containers in 2 separate networks can not talk to each other. Is it possible, however, to deny container in overlay network to reach public internet? Eg to make ping 8.8.8.8 fail, while having docker host connected to internet.


回答1:


If you add the --internal flag when creating a network with the docker network create command, then that network will not have outbound network access:

docker network  create --internal --subnet 10.1.1.0/24 mynetwork

I assume -- but have not tested -- that this works for overlay networks as well as for host-local networks.



来源:https://stackoverflow.com/questions/35735172/is-it-possible-to-isolate-docker-container-in-user-defined-overlay-network-from

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!