Hi all,
I’ve got a node app (mysql-updater) that connects, using the mysql2 module, to the mysql container if I supply the containers IP address.
However, if I try to use the link servicename of “mysql”, which points to the mysql-lb, I get
Error: getaddrinfo ENOTFOUND mysql mysql:3306
Here is my docker-compose file, which you can see includes the “links” config item for the mysql-updater container. Can anyone point out something I’m doing wrong?
version: '2'
services:
mysql-lb:
image: rancher/lb-service-haproxy:v0.6.4
ports:
- 3306:3306/tcp
labels:
io.rancher.scheduler.affinity:host_label: database=yes
io.rancher.container.agent.role: environmentAdmin
io.rancher.container.create_agent: 'true'
mysql:
image: mariadb:10.3.0
environment:
MYSQL_DATABASE: xxx
MYSQL_PASSWORD: xxx
MYSQL_ROOT_PASSWORD: xxx
MYSQL_USER: xxx
stdin_open: true
tty: true
volumes_from:
- mysql-data
labels:
io.rancher.scheduler.affinity:host_label: database=yes
io.rancher.sidekicks: mysql-data
mysql-data:
image: busybox
volumes:
- /mnt/xxx/database:/var/lib/mysql
labels:
io.rancher.scheduler.affinity:host_label: database=yes
io.rancher.container.start_once: 'true'
mysql-updater:
image: xxx/mysql_update
stdin_open: true
tty: true
links:
- mysql-lb:mysql
labels:
io.rancher.container.pull_image: always
io.rancher.scheduler.affinity:host_label: database=yes