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: |
Replies: 19 comments 9 replies
|
Can't you just request the |
|
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. |
|
@SuperSandro2000 I'm not sure to understand your logic. What do you see when you start the container and go to: http://localhost/info ? |
|
Me either but we never know :-p
|
|
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. |
|
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. |
Why? |
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. |
|
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: |
|
I tried but the container does not start: |
|
Are you running it on swarm? If so, make sure to run it in manager nodes. |
|
I didn't see curl in the image so I'm doing the healthcheck with the following |
|
You need to pass |
|
I didn't test it yet, but I feel this makes sense: |
|
|
|
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 |
|
I tested using Using |
|
@jwillmer typo: you are missing a |

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