Is there an healthcheck entrypoint? #24
-
As I plan to use this project along traefik in prod, an healthcheck is required. I would expect something to configure something like:
|
Beta Was this translation helpful? Give feedback.
Replies: 19 comments 8 replies
-
Can't you just request the |
Beta Was this translation helpful? Give feedback.
-
I never faced this yet, so if you can open a PR on how to do that, either with fixes or at least with docs, I'll be glad to review and merge. |
Beta Was this translation helpful? Give feedback.
-
@SuperSandro2000 I'm not sure to understand your logic.
What do you see when you start the container and go to: http://localhost/info ? |
Beta Was this translation helpful? Give feedback.
-
Me either but we never know :-p
|
Beta Was this translation helpful? Give feedback.
-
Since the container is exposing a subset of the docker API, I guess @SuperSandro2000 means that you should just use that API and, if it responds, it means the proxy is doing its work. |
Beta Was this translation helpful? Give feedback.
-
I see your logic. But within the healthcheck context, I don't think the healthcheck function can access the docker's API (specially for this very container which is a proxy). That's why the healthcheck is using a classic ping to know if the container is alive or not.
|
Beta Was this translation helpful? Give feedback.
-
Why? |
Beta Was this translation helpful? Give feedback.
-
The healthcheck function exist because the Docker API cannot know if an APP is up or down. The test needs to happen within the container. When it fails, the the Docker API reboot the container. |
Beta Was this translation helpful? Give feedback.
-
Just access the docker api trough the proxy. If that works the proxy works, if not the proxy does not work. So that could work:
|
Beta Was this translation helpful? Give feedback.
-
I tried but the container does not start:
|
Beta Was this translation helpful? Give feedback.
-
Are you running it on swarm? If so, make sure to run it in manager nodes. |
Beta Was this translation helpful? Give feedback.
-
I didn't see curl in the image so I'm doing the healthcheck with the following |
Beta Was this translation helpful? Give feedback.
-
You need to pass |
Beta Was this translation helpful? Give feedback.
-
I didn't test it yet, but I feel this makes sense:
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I can confirm, that this is working: docker-socket-proxy:
image: tecnativa/docker-socket-proxy:arm32v7
container_name: docker-socket-proxy
restart: unless-stopped
healthcheck:
test: wget --spider http://localhost:2375/version || exit 1
interval: "29s"
timeout: "5s"
retries: 3
start_period: "21s"
privileged: true
networks:
- socket-proxy
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- CONTAINERS='1'
# - ...
ports:
- 127.0.0.1:2375:2375 |
Beta Was this translation helpful? Give feedback.
-
I tested using Using |
Beta Was this translation helpful? Give feedback.
-
@jwillmer typo: you are missing a
|
Beta Was this translation helpful? Give feedback.
-
If @jwillmer's solution is working, maybe we can add it to the docs and close this, then? @yajo |
Beta Was this translation helpful? Give feedback.
I can confirm, that this is working: