use*_*475 10 networking docker
我有一个设置,可以在 docker 容器中运行我网站的所有部分。我侦听端口 80 和 443 的 nginx 在容器中运行。
363292a98545 scivm/nginx-django-scivmcom:latest /usr/bin/supervisord 12 days ago Ghost 0.0.0.0:40001->22/tcp, 88.198.57.112:443->443/tcp, 88.198.57.112:80->80/tcp lonely_feynmann
Run Code Online (Sandbox Code Playgroud)
我想为另一个容器中的服务设置代理。此容器绑定到主机上的端口 3000:
b38c8ef72d0a mazzolino/strider-dind:latest wrapdocker /usr/bin/ 41 minutes ago Up 41 minutes 0.0.0.0:3000->3000/tcp, 22/tcp, 27017/tcp distracted_einstein
Run Code Online (Sandbox Code Playgroud)
我在 docker 主机上的 iptables 如下所示:
root@Ubuntu-1204-precise-64-minimal /var/run # iptables -L
Chain INPUT (policy ACCEPT) target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere tcp dpt:8000
DROP all -- anywhere anywhere
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Run Code Online (Sandbox Code Playgroud)
在容器内,由于 iptables 配置,我无法连接到主机上的端口 3000。
我不想向公共互联网开放端口 3000。
有没有办法在端口 3000 上打开容器和主机之间的直接桥接?
或者我应该修改我的 iptables 以接受 docker ip 范围?
| 归档时间: |
|
| 查看次数: |
10900 次 |
| 最近记录: |