mattyh88
mattyh88

Reputation: 1635

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:

I have another (Laravel) project which is running through the pre-packaged Vagrant Box setup (Homestead).

I'm now trying to connect to the MySQL database (of the Docker setup) from within the Vagrant box of my Laravel project.

What I know for sure:

Host: 127.0.0.1
Port: 3306

What I don't know:

Upvotes: 0

Views: 1458

Answers (1)

homelessDevOps
homelessDevOps

Reputation: 20726

If you can connect from your Workstation in should also work from the VM.

Simply use as connection parameter:

  • IP: Your Workstation IP
  • Port: 3306

Important: Publish the port of the Container with : -p 3306:3306

Upvotes: 1

Related Questions