Trying and failing to get a Container/s to use a working VPN Container as it's Network

  • Hey

    I think I am missing something. I will post my VPN container and my docker container..maybe you can see something I am missing?

    #1 The VPN container does indeed work correctly, I have verified via curl ifconfig.io

    #2 The Docker Containers do work, but keep using my real WAN IP

    #3 I did create the docker network in question.


  • I think that you should not have port statements in containers that use another container's network. They should be defined in the container whose network you want to bind to.

    --
    Google is your friend and Bob's your uncle!


    A backup strategy is worthless unless you have a verified to work by testing restore strategy.


    OMV AMD64 7.x on headless Chenbro NR12000 1U Intel Xeon CPU E3-1230 V2 @ 3.30GHz 32GB ECC RAM.

    OMV AMD64 8.x on headless Tyan Thunder SX GT86C-B5630 1U Server with Intel Xeon Silver 4110 CPU @ 2.10GHz & 32GB DDR4 ECC RAM.

  • Ahh I actually do recall having to do that in the past. I will try that tomorrow and see how it goes. Although, would that also cause its IP address to be my WAN IP? Anyway, I’ll check it tomorrow, ty.

  • I can't say for sure but it would seem to me that if a container can't join the specified network of another container then the current system local network would be used and that would route out via your WAN IP.


    Are you referring to any specific guides to do what you are trying to accomplish, there are plenty of examples out there. ChatGPT is pretty good about things like this.

    --
    Google is your friend and Bob's your uncle!


    A backup strategy is worthless unless you have a verified to work by testing restore strategy.


    OMV AMD64 7.x on headless Chenbro NR12000 1U Intel Xeon CPU E3-1230 V2 @ 3.30GHz 32GB ECC RAM.

    OMV AMD64 8.x on headless Tyan Thunder SX GT86C-B5630 1U Server with Intel Xeon Silver 4110 CPU @ 2.10GHz & 32GB DDR4 ECC RAM.

  • This particular container, llama and open-we up are just for fun. We can be talking about any Container TBH.. I know the qbit/vpn works as should when I curl ifconfig.io and then the stack with web/llama works on its own, I just can’t get the stack to use the vpn for its wan access. Essentially anything being searched or looked up would be behind the vpn.

    No guide necessarily, just figured it should be an easy thing.

  • You need to find a guide that specifically tells you how to setup a container to use the network of another container. There are many available. Start looking.

    --
    Google is your friend and Bob's your uncle!


    A backup strategy is worthless unless you have a verified to work by testing restore strategy.


    OMV AMD64 7.x on headless Chenbro NR12000 1U Intel Xeon CPU E3-1230 V2 @ 3.30GHz 32GB ECC RAM.

    OMV AMD64 8.x on headless Tyan Thunder SX GT86C-B5630 1U Server with Intel Xeon Silver 4110 CPU @ 2.10GHz & 32GB DDR4 ECC RAM.

  • Basic guide.


    Don't define a network or ports in the container you want to put in the vpn network. Define it's ports in the vpn container.


    In the container that you want to put in the vpn use one of these network_mode lines to place it on the network of the vpn container.


    network_mode: container:<container_name_or_id>

    or

    network_mode: service:<service_name>


    Here is an example for concept (this uses the service version. container_name must be specified to use the container version):

    Code
    services:
      web:
        image: nginx
    
      app:
        image: my-app
        network_mode: service:web # Example: sharing network with the 'web' service

    Asrock B450M, AMD 5600G, 64GB RAM, 6 x 4TB RAID 5 array, 2 x 10TB RAID 1 array, 100GB SSD for OS, 1TB SSD for docker and VMs, 1TB external SSD for fsarchiver OS and docker data daily backups

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!