I have two containers; a node.js server, and a mysql server ...
Both are running fine, I'm trying to connect to the database running in the MySQL container from my node app.
I've created a bridge network:
$ docker network create -d bridge mynetwork
and run both of my containers in this network with:
$ docker run -p 32031:3306 --network mynetwork --name mysql -e MYSQL_ROOT_PASSWORD=abc123 -d mysql:5.7
$ docker run -p 3000:3000 --network mynetwork node-server node index.js
I'm trying to connect with the IP of the mysql container that I found with docker inspect mysql
, which is 172.18.0.2
and port 32031
.
Where did it go wrong, it's not connecting?