Docker Community Forums

Share and learn in the Docker community.

Access to mysql outside docker


(Bol83) #1

Hi. We currently testing docker for for our business. What we want is to have our web application running in a docker container and our databases should be outside the docker container. We are testing with docker compose and one node application in one container linked to redis server in another container. What we cant figure out is how to get access to our mysql server outside the docker node js container.


(Sam) #2

like a normal multi-system mysql you need

  1. enable the mysql server to allow remote connections

  2. enable the USER to connect from that (or any) system for that database (at the server)

  3. in the application m use the ip address of the mysql server in the connection string

you probably won’t be able to use its normal DNS system name, but you could add that to the container startup with the rdocker run --add-host name:ipaddress parameter