Skip to content

mysqld.sock missing #2

Description

@karellm

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions