-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't reach database server at dockerhost
#40
Comments
which os do you use? you may need to bind your database port to Use following docker command to get the bridge network gateway IP address |
see README.md Linux Section -> https://github.com/qoomon/docker-host/blob/master/README.md#%EF%B8%8F-on-linux-systems |
@qoomon I'm using Linux Ubuntu. My bad, I used to write the bind-address in a wrong file (/etc/mysql/my.cnf), I just realized that my MySQL config file is /etc/mysql/mysql.conf.d/mysqld.cnf. So I rewrite the bind-address from 127.0.0.1 to 0.0.0.0, because it didn't work with multiple IP address value configuration. I would glad to know if there is any workaround to automatically detect the dockerhost container Gateway IP address and then run a bash command to add a new firewall rule to allow that gateway IP address? Thank you so much. Update: Thank you! |
maybe you can contribute your script, that would be nice because you are not the first person having these troubles. |
@heriisei would love to have a look at your script. i am currently having a hard time finding a solution to that |
I followed https://medium.com/@sam_ngu/connecting-to-docker-host-mysql-from-docker-container-linux-ubuntu-766e526542fd to connect to my host MySQL database.
Inside the other container, I could ping the dockerhost container.
My project is using Prisma as a DB access layer, and pointed to the DB via URL like this:
mysql://user:password@dockerhost:3306/schema
.But when I tried to access the DB. I ended up getting this error:
"Can't reach database server at 'dockerhost':'3306'. Please make sure your database server is running at 'dockerhost':'3306'"
All the configurations are set up as mentioned in the above medium article, like the firewall, DB user, etc.
The dockerhost container log is also showing no error.
I would be so happy to get any solution 😃 from you guys.
Thank you
The text was updated successfully, but these errors were encountered: