Hi to everyone!
I apologize in advance for my doubts, which may sound quite dumb, but I’m writing there since I am having trouble in finding how exactly works network_mode: "service:<service_name>
.
Suppose that service1
is using network_mode: "service:<service2>
.
The only reference I am finding in the documentation is here.
My doubts concerns the handling of the network. From the sentence in the doc, saying that this
gives the containers access to the specified service only
I deduce that (correct me if I am wrong):
service1
cannot directly connect to the internet, but needs to “go through”service2
.- If for whatever reason
service2
has no access to the internet, alsoservice1
cannot reach the internet (and this would be ok) - If for whatever reason
service2
is down,service1
will not reach the internet (and also this would be ok)
But this leaves me some questions:
- How will the network will be managed? Is all left up to the
service2
, or is somehow mediated by thenetwork_mode
? - I am asking it because I would need to hide a docker container behind a VPN, and I ended up finding gluetun, and I was wandering why wouldn’t be possible to simply setup a custom network, and use a vpn container as gateway.
Thanks for everyone in advance! Moreover, if you found other documentation to that, feel free to link it down below!