tailscale-dev/docker-guide-code-examples

healthcheck - when side docker starts

shuther opened this issue · 4 comments

I created a docker compose file with tailscale and another docker (litellm).
It seems tailscale takes a bit longer to start and it is causing a name resolution issue when litellm starts (so it exits). Maybe there is another issue on top.

However, would it be possible to get in the example (docker-compose.yml) a section with:
An healthcheck we can add to the ts-docker (maybe a ping to the hello service) to confirm it started (above all the 1st time when it needs to validate the token?). I am not sure about the best way to do it?

I found the other problem, tailscale docker failed because of:
backend error: requested tags [tag:container] are invalid or not permitted

getting this healthcheck would help.

Just to add on the issue above and maybe I missed the step:
it is important to had a tag called container in the ACL
Even when I selected a tag (not container) when I created the token, it seems it is required to have this tag to get tailscale to work (not sure if expected)

to help others, I am using:

    healthcheck:
      test: ["CMD-SHELL", "tailscale", "-c", "1", "hello.ts.net"]
      interval: 10s
      timeout: 2s
      retries: 5
      start_period: 7s # Estimated time to boot.

But Maybe there is a better approach that doesn't depend on hello?

it is important to had a tag called container in the ACL

Tags are required when using an OAuth token.