Connect docker container to local workbench MySQL DB

后端 未结 1 665
Happy的楠姐
Happy的楠姐 2021-01-02 21:37

HI I have my web app running on my local machine and connected to Mysql workbench, I am now trying to dockerize the webapp. I can\'t seem to get it to conne

相关标签:
1条回答
  • 2021-01-02 21:46

    As mentioned on this post, you can try 2 things:

    1. Add gateway and use it from containers, like

    docker network create -d bridge --subnet 192.168.0.0/24 --gateway 192.168.0.1 dockernet

    1. In addition to your app container, run proxy (ngnix?) container, which will rout the calls to DB when required

    This answer also show how can you obtain the host IP inside the docker container.

    0 讨论(0)
提交回复
热议问题