首页 > 解决方案 > docker-compose 创建一个不在公司 VPN 内的网络

问题描述

介绍

问题

一切正常,直到我打开以下 VPN:

Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere             state ESTABLISHED
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  141.45.0.0/16        anywhere
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:8443 state NEW,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:8636 state NEW,ESTABLISHED

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain DOCKER (0 references)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             172.18.0.2           tcp dpt:postgresql
ACCEPT     tcp  --  anywhere             172.18.0.3           tcp dpt:https
ACCEPT     tcp  --  anywhere             172.18.0.4           tcp dpt:https
ACCEPT     tcp  --  anywhere             172.18.0.5           tcp dpt:https

Chain DOCKER-ISOLATION-STAGE-1 (0 references)
target     prot opt source               destination

Chain DOCKER-ISOLATION-STAGE-2 (0 references)
target     prot opt source               destination

Chain DOCKER-USER (0 references)
target     prot opt source               destination

mircoservice 现在抛出异常Caused by: java.net.ConnectException: Connection timed out

到目前为止我做了什么

查看 iptables 规则我们可以看到 docker-compose 创建的网络地址与公司的 IP 地址不同。所以我认为这就是重点,因为如果我在公司网络之外,我将无法连接到目标服务器。

问题

如何将 docker(-compose) 和/或防火墙配置在公司的 VPN 内部,以便被“另一台服务器?

标签: javadockerdocker-composevpnfirewall

解决方案


推荐阅读