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

Dependant container stops functioning if NordLynx restarts #78

Closed
dem0ngo opened this issue May 22, 2022 · 9 comments
Closed

Dependant container stops functioning if NordLynx restarts #78

dem0ngo opened this issue May 22, 2022 · 9 comments
Labels
bug Something isn't working help wanted Extra attention is needed Stale

Comments

@dem0ngo
Copy link

dem0ngo commented May 22, 2022

Describe the bug

I'm new to routing a container through another one like this, but I have NordLynx set up and things work fine if I create it and the other container that depends on it at the same time. However if NordLynx ever restarts for any reason then the dependent container ceases to function. Even if I restart the dependent container it fails. I have to completely remove and recreate it in order for it to work again.

To Reproduce using docker-compose

  nordlynx:
    image: ghcr.io/bubuntux/nordlynx
    container_name: vpn
    cap_add:
      - NET_ADMIN 
    environment:
      - PRIVATE_KEY=
      - ALLOWED_IPS=0.0.0.0/1,128.0.0.0/1
      - NET_LOCAL=192.168.1.0/24
      - "POST_UP=ip -4 route add $$(wg | awk -F'[: ]' '/endpoint/ {print $$5}') via $$(ip route | awk '/default/ {print $$3}')"
      - "PRE_DOWN=ip -4 route del $$(route -n | awk '/255.255.255.255/ {print $$1}') via $$(ip route | awk '/default/ {print $$3}')"
    ports:
      - 8080:8080
      - 6881:6881
      - 6881:6881/udp
    sysctls:
      - net.ipv6.conf.all.disable_ipv6=1  # Recomended if using ipv4 only
  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent:latest
    container_name: qbittorrent
    network_mode: service:nordlynx 
    depends_on:
      - nordlynx
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
      - WEBUI_PORT=8080
    volumes:
      - ${DOCKERDIR}/qbittorrent1/config:/config 
      - ${DATADIR}/torrents:/data/torrents
    restart: unless-stopped

Expected behavior

If NordLynx restarts then the dependent container should continue to function like normal or be recreated automatically.

Logs

Nothing in the logs that I can find.

@dem0ngo dem0ngo added bug Something isn't working help wanted Extra attention is needed labels May 22, 2022
@dem0ngo dem0ngo changed the title Dependant container doesn't work if NordLynx restarts Dependant container stops functioning if NordLynx restarts May 22, 2022
@infuze999
Copy link

infuze999 commented May 22, 2022

I have had this particular problem for a long time, and I get around it by adding Healthchecks to the services that don't already have it, that depend on the vpn in the docker-compose file like this:

healthcheck:
 test: curl --fail http://google.com || exit 1
 interval: 10s
 timeout: 5s
 retries: 3

Then I run https://hub.docker.com/r/willfarrell/autoheal/ to restart unhealthy services automatically

@dem0ngo
Copy link
Author

dem0ngo commented May 22, 2022

It sounds like this will only restart the containers, but like I mentioned my issue is that I have to recreate the container to get it to work. Will this workaround still fix that issue?

@infuze999
Copy link

Based on your description of the problem it sounds like the exact same problem I had, and the solution worked.
With the exception that if you automatically update VPN, it sometimes messes up and you have to manually restart everything. But only sometimes.

@dem0ngo
Copy link
Author

dem0ngo commented May 22, 2022

Okay I got it up and from what I can tell its working. I stopped the NordLynx container, waited for the qBittorrent health check to take effect, restarted NordLynx, and then waited for autoheal to restart qBittorrent. Once I did that the webui was accessible like I hoped. Thanks for your help!

@dem0ngo dem0ngo closed this as completed May 22, 2022
@dem0ngo
Copy link
Author

dem0ngo commented May 22, 2022

I spoke too soon. If I recreate NordLynx then qBittorrent becomes unhealthy and autoheal gives this generic failure message

22-05-2022 13:05:45 Container /qbittorrent (c07fc6692b4a) found to be unhealthy - Restarting container now with 10s timeout
22-05-2022 13:05:45 Restarting container c07fc6692b4a failed

Is this the issue you were mentioning when the vpn auto-updates? Is this just expected behavior when one container depends on another one?

@infuze999
Copy link

Yes, it's as if docker no longer recognises it as the container others depend on if you edit docker-compose or update image.

@dem0ngo
Copy link
Author

dem0ngo commented May 23, 2022

Hmm, well at least it fixed the issue for simple restarts or interruptions to the VPN container.

@dem0ngo dem0ngo reopened this May 23, 2022
@ginodesilva
Copy link

This is not a NordLynx issue but a docker issue. What I've read is that there is no solution atm. People have created workarounds such as the autoheal suggested above but from what I'm understanding is that no definitive answer to this problem has been found.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed Stale
Projects
None yet
Development

No branches or pull requests

3 participants