Hey,
I'm confused as it appears the the mysql.sock is missing. Here is what I do:
sudo docker build -t wordpress .
sudo docker run -v /srv/wwww/myproject/wordpress/:/var/www/ -d -p 80:80 wordpress
All boots ok, but then when I access the site, I get the famous Error establishing a database connection. So I decided to investigate by running this:
sudo docker run -v /srv/wwww/myproject/wordpress/:/var/www/ -i -t wordpress /bin/bash
mysql -uroot -p
I get: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Ok, so now, I run mysqld_safe & sleep 10s. All good, I can mysql -uroot -p, the /var/run/mysqld/mysqld.sock was created.
What confuses me is that after getting this mysqld.sock, I commited the change to the image. But then the sudo docker run -v /srv/wwww/myproject/wordpress/:/var/www/ -d wordpress /bin/bash /start.sh leads again to mysql connection error.
I've tried many things before asking but I'm totally confused by this behaviour. Thanks!
Hey,
I'm confused as it appears the the mysql.sock is missing. Here is what I do:
All boots ok, but then when I access the site, I get the famous
Error establishing a database connection. So I decided to investigate by running this:I get:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)Ok, so now, I run
mysqld_safe & sleep 10s. All good, I canmysql -uroot -p, the/var/run/mysqld/mysqld.sockwas created.What confuses me is that after getting this
mysqld.sock, I commited the change to the image. But then thesudo docker run -v /srv/wwww/myproject/wordpress/:/var/www/ -d wordpress /bin/bash /start.shleads again to mysql connection error.I've tried many things before asking but I'm totally confused by this behaviour. Thanks!