Docker healthcheck with .NET8 canaries?

I’ve recently been trying to migrate my Docker instance of Duplicati to the latest canaries based on .NET8, and one hiccup I’ve found is the healthcheck that I’ve added not working. The snippet I’ve used in the past is below, but basically it just makes sure that attempting to open the web UI works.

The problem that I’m facing is that the ‘curl’ utility doesn’t seem to be included in the new Docker containers. I don’t see anything else installed that looks like it would similarly be able to make a quick HTTP query and report success or failure, but admittedly not too familiar with unusual capabilities of various Linux utils.

A simple fix would be to just have the Docker container include curl, but since this is all it would be used for I can understand if there is some reluctance to doing so. In any case, the ideal would be for the official Docker definition to have whatever health check is reasonable built-in (by defining something like the below automatically).

Does anyone know of any workarounds in the meantime?

    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8200"]
      interval: 1m30s
      timeout: 30s
      retries: 3
      start_period: 1m

I don’t use Docker, but instead of poking with curl, maybe the new ServerUtil program can do it.

New tool to manage a running server

I think adding cURL is not outside of the scope, but I would rather fix it by having server-util be able to query the server and check if it responds. We should add a real /health endpoint for this purpose.

@ts678 : I added the idea of letting ServerUtil do the check to the issue.

If you are looking for workarounds, I found this Github issue discussing ways to use bash for the same

I agree that adding a dedicated method to ServerUtil (along with a dedicated /health endpoint for it to use) would be ideal.

The bash workaround is interesting, but feels like overkill for my use. For now I’ve just disabled the healthcheck until the official one is ready. Thanks, @kenkendk!

Just following up to report that the ServerUtil now has the feature to do the health checks.

It should be possible to invoke like this:

healthcheck:
  test: /opt/duplicati/duplicati-server-util health
  interval: 60s
  timeout: 30s
  retries: 3
  start_period: 60s

I think it will be difficult to include in the image by default, because the setup may be protected in a way that would require one or more passwords to be given to the server-util binary.

Thank you! I’ve enabled this healthcheck on my container, and at least for the initial start up it appears to be working!

1 Like