Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to disable Docker healthcheck #7732

Closed
RenovatingDev opened this issue Jan 7, 2021 · 1 comment
Closed

Option to disable Docker healthcheck #7732

RenovatingDev opened this issue Jan 7, 2021 · 1 comment

Comments

@RenovatingDev
Copy link

Do you want to request a feature or report a bug?

Feature

What did you expect to see?

As far as I can tell, Treafik seems to remove all Docker containers which use the Docker healthcheck system and do not have status healthy from its dynamic configuration. This is a good default, but I would like to be able to deactivate this behavior and ignore the Docker Health. An example for when someone might want to disable this is when a Docker container reports an unhealthy status while it can still process some of requests, e.g. to a management interface, which may help solve the problem but is no longer accessible though Traefik.

This behaviour also prevents one from using the ping@internal service as a healthcheck in docker combined with labels for custom routing for ping service in the docker-compose file, as this creates a chicken-egg kind of problem.
Traefik will not deploy the routes defined in the docker-compose file because the container has "starting" as health status. Therefore the healthcheck will fail, bringing the container to an "unhealthy" status, preventing the routes to be deployed by Traefik...

Example configuration (for second exmaple)

docker-compose.yml:

version: '3'

services:
  reverse-proxy:
    # The official v2 Traefik docker image
    image: traefik:v2.3
    # Enables the web UI and tells Traefik to listen to docker
    ports:
      # The HTTP port
      - "80:80"
      - "443:443"
      # The Web UI (enabled by --api.insecure=true) (TODO: REMOVE LATER)
      - "8090:8080"
    volumes:
      # So that Traefik can listen to the Docker events
      - /var/run/docker.sock:/var/run/docker.sock
      - ./config/:/etc/traefik/
      - ./log/:/log/traefik/
    healthcheck:
       test: "wget --no-check-certificate --spider localhost:443/mypingroute|| exit 1"
    labels:
      - "traefik.enable=true"
      # dashboard
      - "traefik.http.routers.traefikweb.rule=PathPrefix(`/api`) || PathPrefix(`/dashboard`)"
      - "traefik.http.routers.traefikweb.service=api@internal"
      - "traefik.http.routers.traefikweb.entrypoints=websecure"
      # ping
      - "traefik.http.routers.pingweb.rule=PathPrefix(`/mypingroute`)"
      - "traefik.http.routers.pingweb.service=ping@internal"
      - "traefik.http.routers.pingweb.entrypoints=websecure"

traefik.toml

[global]
  checkNewVersion = true
  sendAnonymousUsage = true

[entryPoints]
  [entryPoints.web]
    address = ":80"
  [entryPoints.websecure]
    address = ":443"

[log]
  filePath = "/log/traefik/traefik.log"

[accessLog]
  filePath = "/log/traefik/traefik-access.log"

[api]
  insecure = true

[ping]
  manualRouting = true

[providers.docker]
  exposedByDefault = false

Additional notes

As far as I could see, there is also no information on this in the official documentation. There should be a note saying that Traefik will exclude Docker containers with a health status not equals "healthy" from its scanning for dynamic configuration.

@SantoDE
Copy link
Collaborator

SantoDE commented Jan 15, 2021

Hello @RSLak1,

thanks a lot for your interest.

This is working as intended. Unhealthy backends will be removed from the load-balancing for good reasons. If you dont wish to have that functionality, you will need to remove the health-check.

@SantoDE SantoDE closed this as completed Jan 15, 2021
@traefik traefik locked and limited conversation to collaborators Feb 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants