I am building on two projects which share some common data. The services of the two projects are built from two docker-compose YML files. I want to access the MySQL server specified in one stack from the Python script running on the other stack.
I am doing so by connecting to an internal docker IP. However, I have found that after server restart, the IP changes. I have tried connecting by container-name, or "linking" container name in docker-compose YML file. Both does not work. I think sharing one docker network interface between two stacks should solve the problem.
May I know how to specify the "network" in the two docker-compose YML file?
Or, is there any better way to achieve this?