首页 文章

docker routing no iptables

提问于
浏览
1

我有一个使用命令 sudo docker run -p 8002:80 nginx 运行的docker nginx图像

我想知道的是路由如何从hostmachine:8002进入容器监听端口80.通常有iptables非常明确地这样做,但如果你禁用iptables它仍然有效 . 然后我注意到有一个 docker-proxy 进程监听每个暴露的端口,我会假设代理/ nat . 所以我用 --userland-proxy=false 禁用了userland代理 . 在这之后我现在只看到一个进程 docker-current ,仍然在监听所有暴露的端口 . 我只能假设 docker-current 进程正在执行nat,但这让我想知道为什么userland代理和/或iptables会在那里?有没有一种方法可以让我看到/证明自己正在发生的事情(即打开/关闭某些东西而不能卷曲我的nginx容器然后能够)?

1 回答

  • 0

    为了完整起见,我将回答我自己的问题 .

    • iptables规则可以通过nat 'ing in kernel space rather than sending it up to userspace to do the nat'来节省时间 . 您可以终止正在侦听端口的进程并删除iptables nat规则而不从流量中获取响应,这就是我(以及其他测试中)能够向我自己证明发生了什么的方式 .

相关问题