Skip to content
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

mysqld.sock missing #2

Open
karellm opened this issue Oct 1, 2013 · 2 comments
Open

mysqld.sock missing #2

karellm opened this issue Oct 1, 2013 · 2 comments

Comments

@karellm
Copy link

karellm commented Oct 1, 2013

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
Copy link
Owner

jbfink commented Oct 2, 2013

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
Copy link
Author

karellm commented Oct 2, 2013

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants