I’ve a simple docker-compose file:
version: '3.4' services: vpn: image: dperson/openvpn-client cap_add: - net_admin networks: - default read_only: true tmpfs: - /run - /tmp restart: unless-stopped security_opt: - label:disable stdin_open: true tty: true volumes: - /dev/net:/dev/net:z - ./vpn-config:/vpn service1: image: consol/centos-xfce-vnc depends_on: - vpn network_mode: "service:vpn" restart: unless-stopped networks: default:
after vpn starts, service1 is started, if I do a
docker-compose exec vpn sh and I try to connect to
127.0.0.1:5901 I successfully connect to the other container.
If for some reason openvpn is restarted (e.g. loss of connectivity) it seems like the link between the containers is lost and connecting to
127.0.0.1:5901 gives connection refused.