Closed Sogl closed 5 years ago
for 0.0.0.0:3306 failed: port is already allocated
I think you have another mysql container started, right ?
I will take a look a laradock, thanks
Yep, another mysql container (in Laradock) is started when I see this error.
you cannot bind 2 containers to the same port.
Either change the port or stop your laradock container before
Change this line: https://github.com/guillaumebriday/laravel-blog/blob/903b4a42a401e15d365c54629faa86c630493067/docker-compose.yml#L27
to 3308:3308
?
What I found in Laradock manual: https://laradock.io/documentation/#change-mysql-port
"3308:3306"
and change your config in .env
file
Does it work ?
Finally works with 3308:3306
.
Config in .env
(strange, but 127.0.0.1
works in TablePlus, but not in Laravel):
DB_CONNECTION=mysql
DB_HOST=mysql
DB_DATABASE=laravel-blog
DB_USERNAME=root
DB_PASSWORD=secret
Thank you for your help! 😉
p.s. Maybe need to add a manual for Laradock users? For me it's more useful for different types of Laravel projects.
There is nothing strange in this config, you need to use 127.0.0.1
in TablePlus because it's not inside the docker network.
In other hand, you can use mysql
in .env
because it's inside docker. :)
I won't add a manual Laradock because it's not related to Laradock nor to this project but it's the way ports on linux work.
Thank you @Sogl
There is nothing strange in this config, you need to use 127.0.0.1 in TablePlus because it's not inside the docker network.
In other hand, you can use mysql in .env because it's inside docker. :)
Now it's clear. Thx!
Hello!
First of all, thx for your work and this repo. I use Laradock docker configuration for multiple projects: https://laradock.io/getting-started/#B
When I start
docker-compose
command in this repo I see this error:When I
docker-compose down
in Laradock anddocker-compose up
yours, all works fine, BUT I can't use my own project 😞 I want to start both projects on my host machine.Also I have differences in my Laradock conf:
Any ideas? Build MySQL with another port?