xmysql icon indicating copy to clipboard operation
xmysql copied to clipboard

Can't connect in docker via 2 container

Open simonlkch opened this issue 3 years ago • 0 comments

using docker in the description

docker run -d
--network local_dev
--name xmysql
-p 4000:80
-e DATABASE_HOST=mysql_host
-e DATABASE_USER=root
-e DATABASE_PASSWORD=password
-e DATABASE_NAME=sys
markuman/xmysql:0.4.2

after docker run it, i could access xmysql on localhost:### 4000

But the result in http://localhost:4000/api/tables , can't connect to DB.

{ "error": { "code": "ECONNREFUSED", "errno": "ECONNREFUSED", "syscall": "connect", "address": "127.0.0.1", "port": 3306, "fatal": true } }

For my mysql service, I create in other container. for my desktop, I could connect mysql service in MySQL Workbench with the same db username and password.


Does anyone know how to set the network on the docker? 1 container -> xmysql 1 container -> mysql

image

simonlkch avatar May 17 '21 09:05 simonlkch