Good day,
I use Kubernetes to run containers in the google container engine.
The idea is to run two containers in a container. One container uses the mysql docker image, the other uses php, laravel, nginx and composer.
Locally it works. The idea is that php can connect to the database on localhost, and this should work if both containers are in the same container. However, when pod is running, we see the following message in the log:
SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
The only difference is that in local testing, I change localhost to the docker internal ip address.
Thanks and good afternoon
Joren source
share