Hi there, I am trying to run a docker-compose file with MySQL and Redis. I get an exception though when I try connecting to MySQL from the application container.
Here is the error.
code: ‘ECONNREFUSED’,
sut_1 | errno: ‘ECONNREFUSED’,
sut_1 | syscall: ‘connect’,
sut_1 | address: ‘127.0.0.1’,
sut_1 | port: 3306,
sut_1 | fatal: true }
Here is my compose file
version: ‘2’
volumes:
services:
web:
build: .
command: “npm start”
links:
- redis
- mysql
volumes:
- .:/usr/app/
- /usr/app/node_modules
ports:
- “3000:3000”
depends_on:
- redis
- mysql
networks:
- web_sql_bridge
redis:
image: ‘bitnami/redis:latest’
environment:
- ALLOW_EMPTY_PASSWORD=yes
ports:
- ‘6379:6379’
mysql:
image: mysql:5.7
container_name: mysql
restart: always
environment:
- MYSQL_ROOT_PASSWORD=“goon”
- MYSQL_DATABASE=“TERRA_TEST”
- MYSQL_DATABASE=“TERRA_DEV”
- MYSQL_USER=“tester”
- MYSQL_PASSWORD=“goon”
ports:
- “3306:3306”
networks:
- web_sql_bridge
volumes:
appconf:networks:
web_sql_bridge:
driver: bridge
I am not sure if the container with MySQL is using that IP address or how to find the IP address?