-
Notifications
You must be signed in to change notification settings - Fork 2k
Cannot connect to mysql container from fpm-alpine container #320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
My first guess is that it is dying trying to find the mysql unix socket file, when it needs to be connecting over a non-localhost connection. If you are using the compose file to start them, then you can connect to the dns name provided by docker (ie, - php -r "new PDO('mysql:host=localhost;port=3306;charset=utf8', 'root', '123123');"
+ php -r "new PDO('mysql:host=docker-mysql;port=3306;charset=utf8', 'root', '123123');" |
@yosifkit yes, you are right. Modifying the host solved the problem. What should I do make it work with |
From one container to another? they would have to be in the same net namespace. Not something I would really recommend since if you ever deploy it, then it would be limited to running the containers on the same host. |
I'm not able to connect to a db container with fpm-alpine image. Do I miss something or is it not possible with this image?
Bellow is my full configuration:
docker-compose.yml:
docker/php-fpm/Dockerfile:
When I try to ssh into container
and test the connection to db I get
The text was updated successfully, but these errors were encountered: