1. Installation
docker run -it -p 3306:3306 --name mysql1 -v ~/mysql/conf/my.cnf:/etc/mysql/my.cnf -v ~/mysql/logs:/logs -v ~/mysql/data:/mysql_data -e MYSQL_ROOT_PASSWORD=123456 -d docker.io/mysql /bin/bash
2. Container startup
3. After entering the container using attach, I did not see the mysql process
1. It is not recommended to mount files directly, generally mount folders
2. After entering the container, manually execute the command docker-entrypoint.sh and see what error message is output
1. It means that your mysql has not been started, because your /bin/bash has already exposed the problem.
2. Try starting like this
You can understand the cause of the problem by reading the official description of CMD and entrypoint instructions.
The following is my test result