I run a MySQL container with --net=host
option.
So now i can make unit test using:g:
self.db = MySQLdb.connect(host="127.0.0.1", user="XYZ", passwd="XYZ", db="TEST_DB")
The problem is when I try to dockerize my unit test, linking the container with my MySQL container, the 127.0.0.1
IP is not valid. I need to use the real ip for the MySql container, or use the DNS (/etc/hosts
file).
So I need to alter the ip 127.0.0.1
for the name of the MySQL host.
I imagine that there is a better way to do this? I can, for example, alter the /etc/hosts
file of my development enviroment.
Aucun commentaire:
Enregistrer un commentaire