Skip to content

Health check not compatible with containers that use a non standard host IP binding #1666

@cosmikwolf

Description

@cosmikwolf

When I am running blocky, it reports that it is unhealthy, even though it is running correctly:

ubuntu@server /m/d/d/blocky> docker ps
CONTAINER ID   IMAGE                           COMMAND                  CREATED         STATUS                     PORTS                                                                                                                 NAMES
9227503fa980   ghcr.io/0xerr0r/blocky:latest   "/app/blocky"            4 minutes ago   Up 4 minutes (unhealthy)   192.168.20.96:53->53/tcp, 192.168.50.47:4000->4000/tcp, 192.168.20.96:53->53/udp                                      blocky

The health check command is failing:

ubuntu@miniserver /m/d/d/blocky> docker compose exec blocky /app/blocky healthcheck
NOT OK
Error: dial tcp 127.0.0.1:53: connect: connection refused

I believe this is because I am using a non standard host binding port in my docker compose file:

My dockerfile:

services:
  blocky:
    image: "ghcr.io/0xerr0r/blocky:latest"
    container_name: blocky
    restart: unless-stopped
    networks:
      - dns
    # Optional the instance hostname for logging purpose
    hostname: "blocky"
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "4000:4000/tcp"
    environment:
      - TZ=PST
    volumes:
      # Optional to synchronize the log timestamp with host
      - /etc/localtime:/etc/localtime:ro
      # config file
      - ./config.yml:/app/config.yml

networks:
  dns:
    driver: bridge
    driver_opts:
      com.docker.network.bridge.host_binding_ipv4: "192.168.20.96"

If there was an --ip flag on healthcheck, I would be able to set the bound IP address. Maybe there is already an env variable I am unaware of?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions