I am trying to bundle two containers using dockers.
MySQL Dockerfile:
...
EXPOSE 3306
CMD ["/usr/sbin/mysqld"]
Dockerfile application file:
...
ADD . /services
CMD ["python", "-u", "services/run_tests.py"]
In run_tests.py I used
self.db = MySQLdb.connect(host="mysql", user="XYZ", passwd="XYZ", db="TEST_DB")
In my docker-compose.yml:
app:
build: .
links:
- mysql
mysql:
image: XYZ/KJM
When I started docker-compose up
, I was unable to connect to the mysql container.
OperationalError: (2003, "Cannot connect to MySQL server on" rds "(111)")
EDIT: I don't know if I need to wait a bit to launch the docking application. I assume that MySQL does not support an application that is trying to connect.
source
share