netbirdio / netbird

Connect your devices into a secure WireGuard®-based overlay network with SSO, MFA and granular access controls.
https://netbird.io
BSD 3-Clause "New" or "Revised" License
11.32k stars 519 forks source link

Docker/Podman healthcheck doesn't work with signal and relay containers #2930

Open mradermaxlol opened 1 week ago

mradermaxlol commented 1 week ago

Describe the problem

Docker/Podman healthcheck fails for signal & relay containers as, apparently, there is no /bin/sh in their base (distroless) image: Error: crun: executable file /bin/sh not found in $PATH: No such file or directory: OCI runtime attempted to invoke a command that was not found Healthcheck works fine for e.g. management container (as it's Ubuntu-based).

AFAIK the healthcheck mechanism doesn't allow specifying a binary path directly (and so /bin/sh invocation can't be bypassed).

I'm using the following healthcheck snippets for signal & relay, respectively:

healthcheck:
  start_period: 5s
  timeout: 3s
  interval: 15s
  retries: 2
  test: "ps aux | grep -v grep | grep -q netbird-signal || exit 1"
healthcheck:
  start_period: 5s
  timeout: 3s
  interval: 15s
  retries: 2
  test: "ps aux | grep -v grep | grep -q netbird-relay || exit 1"

As a suggestion on how to make it work - perhaps it's worth creating symlink to the actual shell in the containers' Dockerfiles? One extra line sounds reasonable.

To Reproduce

Steps to reproduce the behavior:

  1. Add the aforementioned healthcheck snippets to the compose file (for signal & relay containers)
  2. Start the compose project
  3. Experience healthcheck errors in system logs
  4. Also experience wrong container health status

Expected behavior Healthcheck works for singal & relay containers.

Are you using NetBird Cloud? No.

NetBird version 0.32.0

NetBird status -dA output: N/A

Do you face any (non-mobile) client issues? N/A

Screenshots N/A

Additional context N/A