qdm12 / gluetun

VPN client in a thin Docker container for multiple VPN providers, written in Go, and using OpenVPN or Wireguard, DNS over TLS, with a few proxy servers built-in.
https://hub.docker.com/r/qmcgaw/gluetun
MIT License
6.71k stars 331 forks source link

Prowlarr cannot connect to Radarr/Sonarr when behind gluetun #2187

Closed Daive01 closed 2 months ago

Daive01 commented 3 months ago

Is this urgent?

Yes

Host OS

Windows: Docker Desktop

CPU arch

None

VPN service provider

NordVPN

What are you using to run the container

docker-compose

What is the version of Gluetun

Running version latest built on 2024-03-26T07:27:44.668Z (commit 6b2f350)

What's the problem ๐Ÿค”

Today I was connecting Radarr/Sonarr to Prowlarr, which is using gluetun, and it wouldn't work. So I tried running Prowlarr in a compose file with no connection to gluetun, and it connected just fine. I am on the latest release of all images. Also, the API keys for Radarr/Sonarr are all correct, and I have tried using "localhost" and the server's address to try to connect, but to no avail.

P.S. I am relatively new to this stuff, so the less complicated the solution, the better.

Thanks

Share your logs (at least 10 lines)

2024-03-26 04:08:21 [Warn] ProwlarrErrorPipeline: Invalid request Validation failed: 
2024-03-26 04:08:21  -- BaseUrl: Unable to complete application test, cannot connect to Radarr. Connection refused (localhost:7878)

Share your configuration


version: "3"
services:
  gluetun:
    image: qmcgaw/gluetun
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun
    ports:
      - 6881:6881     # qbittorent
      - 6881:6881/udp # qbittorent
      - 8080:8080     # qbittorent
      - 8191:8191     # flaresolverr
      - 9696:9696     # prowlarr
    environment:
      - VPN_SERVICE_PROVIDER=nordvpn
      - VPN_TYPE=wireguard
      - WIREGUARD_PRIVATE_KEY=CORRECT
      - SERVER_COUNTRIES=CORRECT
      - SERVER_CITIES=CORRECT
      - TZ=CORRECT
    volumes:
      - CORRECT:/gluetun
    restart: always

  prowlarr:
    image: lscr.io/linuxserver/prowlarr:latest
    container_name: prowlarr
    network_mode: "service:gluetun"
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=CORRECT
    volumes:
      - CORRECT:/config
    restart: unless-stopped
    depends_on:
      gluetun:
        condition: service_healthy

  flaresolverr:
    image: ghcr.io/flaresolverr/flaresolverr:latest
    container_name: flaresolverr
    network_mode: "service:gluetun"
    environment:
      - TZ=CORRECT
    restart: unless-stopped 
    depends_on:
      gluetun:
        condition: service_healthy

  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent:latest
    container_name: qbittorrent
    network_mode: "service:gluetun"
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=CORRECT
      - WEBUI_PORT=8080
      - TORRENTING_PORT=6881
    volumes:
      - CORRECT:/config
      - CORRECT:/downloads
    restart: unless-stopped
    depends_on:
      gluetun:
        condition: service_healthy
github-actions[bot] commented 3 months ago

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

vfaergestad commented 3 months ago

Can you include your Sonarr/Radarr configuration?

Nicxx2 commented 3 months ago

Something that I did was to include a hostname as well for gluetun:

An example: image

So for your example, with Prowlarr to communicate with Radarr, you can just put the hostname of gluetun and the port. *Note: For this to work, you need to have Radarr and Prowlarr go through gluetun. Make sure to have all the ports needed in the gluetun service as well.

As an example: image

Hope this helps. ๐Ÿ˜

Daive01 commented 3 months ago

Something that I did was to include a hostname as well for gluetun:

An example: image

So for your example, with Prowlarr to communicate with Radarr, you can just put the hostname of gluetun and the port. *Note: For this to work, you need to have Radarr and Prowlarr go through gluetun. Make sure to have all the ports needed in the gluetun service as well.

As an example: image

Hope this helps. ๐Ÿ˜

Thanks for your input and help.

I heard that running Radarr/Sonarr behind glutun causes some problems. But ill definitely try this out as a last resort.

Something i forgot to mention in the original post was that Prowlarr is able to connect fine to Qbitttorrent and flaresolverr which are also using gluetun. But not with Radarr/Sonarr which are not.

Daive01 commented 3 months ago

Can you include your Sonarr/Radarr configuration?

services:
  radarr:
    image: lscr.io/linuxserver/radarr:latest
    container_name: radarr
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=CORRECT
    volumes:
      - CORRECT:/config
      - CORRECT:/data
    ports:
      - 7878:7878
    restart: unless-stopped

  sonarr:
    image: lscr.io/linuxserver/sonarr:latest
    container_name: sonarr
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=CORRECT
    volumes:
      - CORRECT:/config
      - CORRECT:/data
    ports:
      - 8989:8989
    restart: unless-stopped
Nicxx2 commented 3 months ago

Some extra notes:

In a Docker environment, "localhost" within a container refers to that specific container's own network environment, not to the host machine or any other container. When a container is configured to use another container's network stack (with network_mode: service:), "localhost" in that context points to the network environment of the container it's linked to. This means that "localhost" is isolated to the local scope of the container's network namespace, making direct communication between containers using "localhost" not feasible (not in the same network space). For inter-container communication, Docker's internal networking and DNS resolution using container names are used instead.

If you tried other options, try the below as well. I put all the containers that you shared into one stack. I made some adjustments:

*This is based on what you shared. Make sure all the ports, paths etc. are correct and what is expected for each service to work properly.

*Remember to use the hostname (in this example: mediagluetun) in Prowlarr (or other service) to connect to the servers (Radarr, Sonarr etc.). See the example from my previous comment above.

version: "3"
services:
  gluetun:
    image: qmcgaw/gluetun
    container_name: gluetun
    hostname: mediagluetun
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun
    ports:
      - 6881:6881     # qbittorent
      - 6881:6881/udp # qbittorent
      - 8080:8080     # qbittorent
      - 8191:8191     # flaresolverr
      - 9696:9696     # prowlarr
      - 8989:8989     # sonarr
      - 7878:7878     # radarr
    environment:
      - VPN_SERVICE_PROVIDER=nordvpn
      - VPN_TYPE=wireguard
      - WIREGUARD_PRIVATE_KEY=CORRECT
      - SERVER_COUNTRIES=CORRECT
      - SERVER_CITIES=CORRECT
      - TZ=CORRECT
    volumes:
      - CORRECT:/gluetun
    restart: always

  prowlarr:
    image: lscr.io/linuxserver/prowlarr:latest
    container_name: prowlarr
    network_mode: "service:gluetun"
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=CORRECT
    volumes:
      - CORRECT:/config
    restart: unless-stopped
    depends_on:
      - gluetun

  flaresolverr:
    image: ghcr.io/flaresolverr/flaresolverr:latest
    container_name: flaresolverr
    network_mode: "service:gluetun"
    environment:
      - TZ=CORRECT
    restart: unless-stopped 
    depends_on:
      - gluetun

  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent:latest
    container_name: qbittorrent
    network_mode: "service:gluetun"
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=CORRECT
      - WEBUI_PORT=8080
      - TORRENTING_PORT=6881
    volumes:
      - CORRECT:/config
      - CORRECT:/downloads
    restart: unless-stopped
    depends_on:
      - gluetun

  radarr:
    image: lscr.io/linuxserver/radarr:latest
    container_name: radarr
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=CORRECT
    volumes:
      - CORRECT:/config
      - CORRECT:/data

    restart: unless-stopped
    network_mode: "service:gluetun"
    depends_on:
      - gluetun

  sonarr:
    image: lscr.io/linuxserver/sonarr:latest
    container_name: sonarr
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=CORRECT
    volumes:
      - CORRECT:/config
      - CORRECT:/data

    restart: unless-stopped
    network_mode: "service:gluetun"
    depends_on:
      - gluetun
Daive01 commented 3 months ago

Everything seems to work well. my overseerr container is still able to connect to Arrs without having to use gluetun, and prowlarr can connect to Flaresolverr, qbit, and Arrs without any problems. The only problem I had was that, for some reason, when container_name: gluetun was defined, I was not able to access any of the services. but when I removed it, it fixed itself.

I'll update this post in a few days if I notice any problems.

I really appreciate your help and time. thank you very much, Sir Nicxx2

A quick question I have is: is there anyway for my IP to get leaked using this config, or is it bulletproof?

Nicxx2 commented 3 months ago

You're welcome @Daive01 . Happy to help ๐Ÿ˜

Anything that is using gluetun as a network mode should be okay. ๐Ÿ‘

If you are using docker for windows you could try the below, to verify the external ip address for a specific container you are running.

First connect to the container using docker exec -it <container_name_or_id> bash.(you can use command prompt). Once inside the container's shell, execute curl ip.me to display the container's external IP address as seen by the internet. This will confirm that the vpn is actually working.

Normally if the vpn goes down, you will notice that those containers connected to gluetun no longer have internet. This is good because the only way you want to connect to the internet is the VPN.

Daive01 commented 3 months ago

Everything seems to be working well. Thanks once again๐Ÿ˜„

github-actions[bot] commented 2 months ago

Closed issues are NOT monitored, so commenting here is likely to be not seen. If you think this is still unresolved and have more information to bring, please create another issue.

This is an automated comment setup because @qdm12 is the sole maintainer of this project which became too popular to monitor issues closed.