mysql container starts failing with Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock.
, even though you created the correct volume that is used by mysqld
and it has the correct permissions (777). The problem persists even if you remove the pid files from mysqld dir or it is empty already.
Hell if I know. My guess is: "Enable external locking (system locking), which is disabled by default. If you use this option on a system on which lockd does not fully work (such as Linux), it is easy for mysqld to deadlock."
https://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_external-locking
- Copy the mysql container id:
$ docker ps -a | grep mysql
4f5b9dfabae9
-
Create something which we can identify the container with within aufs:
docker container start 4f5b9dfabae9 && docker exec -it 4f5b9dfabae9 touch abcdef
-
Find the mnt folder for that container:
./aufs/diff/b3eae04cf6d5ec394f233e917568b64dafc42fa5a0be7591174164f0e42edd3e/abcdef
./aufs/mnt/b3eae04cf6d5ec394f233e917568b64dafc42fa5a0be7591174164f0e42edd3e/abcdef
-
Using the path you found, edit my.cnf and add
skip-external-locking
to the last line:vim ./aufs/mnt/b3eae04cf6d5ec394f233e917568b64dafc42fa5a0be7591174164f0e42edd3e/etc/mysql/mysql.cnf
-
?????????????????
-
Profit!
TLDR add skip-external-locking to my.cnf:
e.g. /var/lib/docker/aufs/mnt/b3eae04cf6d5ec394f233e917568b64dafc42fa5a0be7591174164f0e42edd3e/etc/mysql/my.cnf
Long(er) term solution: rebuild image so that mysqld starts with skip-external-locking https://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_external-locking