Code Monkey home page Code Monkey logo

Comments (5)

outranker avatar outranker commented on May 20, 2024 1

@heriisei would love to have a look at your script. i am currently having a hard time finding a solution to that

from docker-host.

qoomon avatar qoomon commented on May 20, 2024

which os do you use? you may need to bind your database port to 0.0.0.0 or the bridge network gateway in addition to localhost(127.0.0.1), to allow connections from docker host container.
By default most database server do bind only to 127.0.0.1

Use following docker command to get the bridge network gateway IP address
docker network inspect bridge --format='{{( index .IPAM.Config 0).Gateway}}'

from docker-host.

qoomon avatar qoomon commented on May 20, 2024

see README.md Linux Section -> https://github.com/qoomon/docker-host/blob/master/README.md#%EF%B8%8F-on-linux-systems

from docker-host.

heriisei avatar heriisei commented on May 20, 2024

@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.
And now the connection between the container and my host database is pretty well established.

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?
For now, I do manually run docker inspect | grep Gateway to get the IP and manually run the firewall command via terminal, every time after I run docker-compose up --build.

Thank you so much.


Update:
Nevermind, I already make a simple bash script to run after docker-compose, to updating the UFW firewall rule.

Thank you!

from docker-host.

qoomon avatar qoomon commented on May 20, 2024

maybe you can contribute your script, that would be nice because you are not the first person having these troubles.

from docker-host.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.