1. Import mysql5.7 mirrored docker
[root@master_150 ~]# docker load -i mysql-5.7.tar
2. Run containers
[root@master_150 ~]# docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
-p3306: 3306: port mapping to the container 3306 to the port 3306 of the host;
-v $ PWD / mysql: / var / lib / mysql: the current directory of the host / mysql mounted to the container / var / lib / mysql;
-e MYSQL_ROOT_PASSWORD = password: initializing root password;
--name name to the container, mysql57
-d represents a container running in the background
3. Go to the container
[root@master_150 ~]# docker exec -it mysql bash
4. Go to the client
[root@master_150 ~]# mysql -uroot -p
5. Check mysql version
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.25 |
+-----------+
1 row in set (0.04 sec)