Skip to content

Docker image has DNS problems #788

@gvlasov

Description

@gvlasov

Describe the bug
I couldn't have it connect to mysql host, it would not resolve it despite being able to ping the container by IP.

Had to switch to https://hub.docker.com/r/justwatch/sql_exporter just because it has working DNS.

To Reproduce

services:
  mysql:
    # Some generic mysql configuration
  sql-exporter:
    image: burningalchemy/sql_exporter
    environment:
      - CONFIG=/config.yml
    volumes:
      - ./sql_exporter.yml:/config.yml:ro
    networks:
      - backend
$ docker compose exec sql-exporter ping mysql -c 1
ping: bad address 'mysql'
---
jobs:
  - name: "offers_count"
    interval: '10s'
    connections:
      - 'mysql://login:password@(mysql:3306)/whatever'
    queries:
      - name: "record_count"
        help: "Records count"
#        labels:
#          - "datname"
#          - "usename"
        values:
          - "count"
        query:  |
          SELECT count(*) AS row_count FROM records
        allow_zero_rows: false

Expected behavior
ping mysql reaches mysql service by hostname

Additional context
Otherwise works fine, but I can't rely on an IP for DSN, need a hostname.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions