Ali cloud -docker install mysql

1, check the kernel version must be 3.10 or above uname -r

2、安装docker yum install docker

3, an input to confirm the installation y

4, start docker: service docker start

 

5: Search Mirror: docker search mysql  

 

 

6: Mirroring can enter the official website Baidu dockerhub view, the official website has details of the operation command.

7: Pull Mirror: docker pull mysql ---- here if you do not add the default tag command to pull the latest version of

8: After pulling off, you can be seen through the mirror docker images mysql

9. Run msql; by the following command

RUN --name MySQL -d mysql1 Docker: Latest -p 3306: 3306 = 111111 MYSQL_ROOT_PASSWORD -e

-d: background

-p: container mapping

mysql1: Alias

3306 before: virtual machine port

3306 after: Container Port

111111: database password;

10. Ali cloud into the console, add port 3306, do not add the words outside the network is not accessible.

 

 

 

 

11; you can view the mysql run by docker ps -a command

 

 

 12: We want to enter the mysql container can use the following command: 

  docker exec -it f7b404a6840e bash Note: it is behind the container id you run

 

 

13. Log msql command   mysql -uroot -p

 

  

 

 14: Finally, Mysql client connections

  

 

 The above operation is also a reference to this URL: https: //blog.csdn.net/long_dragon123/article/details/83315892;

The friend in question, you can leave a message below.

  

 

 

 

 


 

 

 

 

Guess you like

Origin www.cnblogs.com/hellohero55/p/11919542.html