Docker Community Forums

Share and learn in the Docker community.

Please help me to conect mysql database to docker

docker
dockercloud
dockerhub

(Abhinavsharma1494) #1

I have my image processing codes in Docker containers. my database is MySQL database now the client sends the image through rest API to the database. now I want to connect the database to Docker containers so that the images sent by the client are sent to those containers and get processed. and the response generated is sent to the database back.

Could someone please explain me the procedure to connect the docker to the database.


(Junius) #2

You could create both containers on the same overlay network. Then the app container could talk with mysql. See docker connect a service to the overlay network.

Another thing you need to consider is mysql data persistence. When mysql container moves to another node, it should be able to read the existing data. You may refer to the discussions in the question: Data(base) persistence in docker swarm mode.