jbfink / docker-wordpress

Dockerfile and etc for a Wordpress docker image
The Unlicense
277 stars 120 forks source link

mysqld.sock missing #2

Open karellm opened 11 years ago

karellm commented 11 years ago

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!

jbfink commented 11 years ago

Hey @karellm

I've never tried to use my docker-wordpress setup with an external data volume, so I'm guessing it's something in there that's causing issues -- especially if you haven't modified the wp-config.php file in your external mount. Could you do me a favour and try to run it according to my README -- that is, from the git clone:

docker build -t karellm/wordpress .
docker run -d karellm/wordpress

and then let me know if you're still having the mysqld sock errors? Thanks!

karellm commented 11 years ago

So sudo docker run -d -p 80:80 karellm/wordpress works just fine after a git clone.

Adding the -v mount option cause the following output:

ssh user password: oodie7Eo
131002 04:07:13 mysqld_safe Logging to syslog.
131002 04:07:13 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
mysql root password: Cae2Woosheid
wordpress password: apaeyay3AeV1
chown: changing ownership of `/var/www/wp-config.php': Operation not permitted
131002 04:07:24 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
/usr/local/lib/python2.7/dist-packages/supervisor-3.0-py2.7.egg/supervisor/options.py:295: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
  'Supervisord is running as root and it is searching '
2013-10-02 04:07:33,948 CRIT Supervisor running as root (no user in config file)
2013-10-02 04:07:33,980 INFO RPC interface 'supervisor' initialized
2013-10-02 04:07:33,980 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2013-10-02 04:07:33,980 INFO supervisord started with pid 375
2013-10-02 04:07:34,984 INFO spawned: 'httpd' with pid 378
2013-10-02 04:07:34,986 INFO spawned: 'sshd' with pid 379
2013-10-02 04:07:34,987 INFO spawned: 'mysqld' with pid 380
2013-10-02 04:07:36,373 INFO success: httpd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2013-10-02 04:07:36,373 INFO success: sshd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2013-10-02 04:07:36,373 INFO success: mysqld entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

The chown command over the wp-config.php fails. But it shouldn't be needed to connect to mysql. Do you have any idea what is going on?

On a side note, I modified the start.sh. I commented the 4 modifications and maybe that some of them could find there way back in this repo: https://gist.github.com/karellm/6788910