[英]Access network in other docker container
I have two docker containers. 我有两个Docker容器。 The first has an OpenVPN server where multiple clients are connected.
第一个有一个OpenVPN服务器,其中连接了多个客户端。 Now I want to reach one of the clients through the VPN from the other container (for example with a simple
ping
command). 现在,我想从另一个容器通过VPN到达一个客户端(例如,使用简单的
ping
命令)。 Is that possible? 那可能吗?
At the moment I linked the containers this way: 目前,我以这种方式链接了容器:
version: '3'
services:
app:
build:
context: .
dockerfile: app.dockerfile
links:
- ovpn:ovpn
ovpn:
build:
context: .
dockerfile: ovpn.dockerfile
working_dir: /etc/openvpn
privileged: true
volumes:
- ./openvpn:/etc/openvpn
ports:
- 1194:1194/udp
I also tried it with the new networks
key (docker compose version 3.5
), but this also doesn't work. 我还尝试了新的
networks
密钥(docker compose版本3.5
),但这也行不通。
I think that my approach is useless, because the link and network keys are only to make the containers themselves reachable. 我认为我的方法没有用,因为链接和网络密钥只是使容器本身可访问。 But I hope there is an other possibility.
但我希望还有其他可能性。
Yes, it is possible. 对的,这是可能的。 Theoretically, both containers are in the same network .
从理论上讲,两个容器都在同一个网络中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.