[英]How to connect to MySQL database in docker container from Vagrant box?
I have a Symfony project which I'm running in 3 docker containers: 我有一个在3个Docker容器中运行的Symfony项目:
I have another (Laravel) project which is running through the pre-packaged Vagrant Box setup (Homestead). 我有另一个(Laravel)项目正在通过预包装的Vagrant Box设置(Homestead)运行。
I'm now trying to connect to the MySQL database (of the Docker setup) from within the Vagrant box of my Laravel project. 我现在正在尝试从Laravel项目的Vagrant框中连接到MySQL数据库(Docker安装程序)。
What I know for sure: 我肯定知道的是:
Host: 127.0.0.1 主持人:127.0.0.1
Port: 3306 端口:3306
What I don't know: 我不知道的是:
If you can connect from your Workstation in should also work from the VM. 如果可以从Workstation连接,则也可以从VM运行。
Simply use as connection parameter: 只需将其用作连接参数:
Important: Publish the port of the Container with : -p 3306:3306 要点:使用以下命令发布容器的端口:-p 3306:3306
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.