1. First cd under the /etc/docker folder, check if there is daemon.json, if there is no such file, create a new one
touch daemon.json
2. Enter the following in the vi daemon.json file:
{
"registry-mirrors": ["https://9cpn8tt6.mirror.aliyuncs.com"]
}
3. Restart the service:
systemctl daemon-reload
systemctl restart docker
Docker installs percona and solves the crash problem
1. Pull the image: docker pull percona:5.7.23
2. Create a container:
docker create --name percona -v /data/mysql-data:/var/lib/mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root percona:5.7.23 #Parameter
explanation:
--name: percona Specify the name of the container
-v: /data/mysql-data:/var/lib/mysql Mount the host directory /data/mysql-data to the container
's /var/lib/mysql
-p: 33306:3306 Set the port Mapping, the host port is 33306, the internal port of the container is 3306
-e: MYSQL_ROOT_PASSWORD=root Set the container parameters, set the password of the root user to root
percona:5.7.23: Mirror name: version
3. Start the container
docker start percona
4. Solve the crash problem:
chmod -R 777 /data/mysql-data
5. Restart again: (restart to take effect)
docker start percona
6. docker ps check again