Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: adding containers to gluetun breaks existing networking of these containers (without network_mode: "service:gluetun" networking is working) #2412

Open
distributev opened this issue Aug 14, 2024 · 1 comment

Comments

@distributev
Copy link

Is this urgent?

No

Host OS

No response

CPU arch

x86_64

VPN service provider

ProtonVPN

What are you using to run the container

docker-compose

What is the version of Gluetun

latest qmcgaw/gluetun docker image

What's the problem 🤔

Thank you for your work on gluetun.

gluetun would be useful but I cannot seem to get it working.

This would not work.

    network_mode: "service:gluetun"
    networks:
      - bridge_current_host_cross_containers_net

This would work

    networks:
      - bridge_current_host_cross_containers_net

As soon as I add network_mode: "service:gluetun" to services gluetun would start to work (as expected) but existing networks become broken (not expected).

Because of that I cannot get containers which are using gluetun to connect to existing database services which are part of the bridge_current_host_cross_containers_net or to any other service which is part of bridge_current_host_cross_containers_net

I did run the command docket network inspect bridge_current_host_cross_containers_net and none of the services for which I added network_mode: "service:gluetun" are listed there (and because of that I cannot get connectivity between them).

I tried having gluetun on its separate network but nothing seems to work.

I also tried making gluetun part of the existing bridge_current_host_cross_containers_net but it does not work also.

It is like we I am forced to choose either

  1. Either use a VPN when accessing the internet (network_mode: "service:gluetun")
  2. Either be able to connect to your database

Both in the same time are not possible and this does not make sense. It should be allowed to use a VPN and to connect to a database both in the same time.

Did anybody encounter the same? How to overcome this situation and have services to use both a VPN for external internet connectivity and to also be able to connect to docker services (databases) running on the same docker network locally?

Share your logs (at least 10 lines)

[Symbol(kRejectNonStandardBodyWrites)]: false,
      [Symbol(kUniqueHeaders)]: null
    },
    _currentUrl: 'https://ifconfig.me/',
    [Symbol(kCapture)]: false
  },
  cause: Error: getaddrinfo ENOTFOUND my-db-service
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
    errno: -3008,
    code: 'ENOTFOUND',
    syscall: 'getaddrinfo',
    hostname: 'my-db-service'
  }
}

Share your configuration

my-db-service:
  networks:
    - bridge_current_host_cross_containers_net

//if I remove network_mode: "service:gluetun" I can connect to the dababase but cannot use the VPN
//If I add network_mode: "service:gluetun" I can use the VPN but cannot connect to database
my-service
  depends-on:
    - my-db-service 
  network_mode: "service:gluetun"
  networks:
    - bridge_current_host_cross_containers_net

gluetun:
  networks:
    - bridge_current_host_cross_containers_net
 
networks:
  bridge_current_host_cross_containers_net:
    driver: bridge
    external: true
Copy link
Contributor

@qdm12 is more or less the only maintainer of this project and works on it in his free time.
Please:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant