Skip to content

mysql-exporter use invalid ip #137

@gimler

Description

@gimler

I have two docker compose file one for the prometheus stuff one for my project. I share the network but the mysql-exporter use another ip address?

Error message Error pinging mysqld: dial tcp 10.67.76.55:3306: getsockopt: no route to host

When i log into the container with docker exec -it prometheus_mysqld-exporter_1 sh and call ping db i get 172.21.0.2 instate of 10.67.76.55

ping db

PING db (172.21.0.2): 56 data bytes
64 bytes from 172.21.0.2: seq=0 ttl=64 time=0.070 ms
64 bytes from 172.21.0.2: seq=1 ttl=64 time=0.055 ms

mysql-exporter docker-compose.yml

version: '2'

services:
mysqld-exporter:
    image: "prom/mysqld-exporter"
    expose:
      - "9104"
    external_links:
      - db-master:db
    environment:
      - DATA_SOURCE_NAME=root:123456@(db:3306)/
    networks:
      - default
      - project

networks:
  project:
    external:
      name: project_default

project specific docker-compose.yml

version: '2'

services:
  db-master:
    restart: always
    image: mariadb:10.1.12
    expose:
      - "3306"
    environment:
      - MYSQL_ROOT_PASSWORD=123456

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions