Today there is a test environment ubuntu + mysql, mysql failed to start when the container containing the restart, leading docker failed to start.
First check docker log
docker logs 8a16
We find the following error:
* Stopping MySQL database server mysqld
...done.
* Starting MySQL database server mysqld
...fail!
So basically the investigation leading to the accident did not start mysql service failed to start docker. Because I added a set -e command in the startup script start.sh
So the next step is to look at what mysql error report.
Docker start immediately when entering the container, or wait for the next failure of the container was closed.
docker start 8a16
docker exec -it 8a16 /bin/bash
View mysql error log
cat /var/log/mysql/error.log
It found that several tests failed to start being given are the following errors.
2018-12-18T09:58:41.325466Z 0 [ERROR] Another process with pid 439 is using unix socket file.
2018-12-18T09:58:41.325486Z 0 [ERROR] Unable to setup unix socket lock file.
2018-12-18T09:58:41.325528Z 0 [ERROR] Aborting
When docker restart vessel, sometimes leading to mysql close unexpectedly and then generate a mysql.sock.lock in the directory, the reason for the existence of this document lead to mysql service failed to start.
So I start my script adds a row start.sh
rm -rf /var/run/mysqld/mysqld.sock.lock
Then a few were successful test launch container. This problem has been resolved.
PS: before encountered mysql service failed to start, and then start the script adds a row choen -R mysql: mysql / var / lib / mysql / var / run / msqld