Start the database using a docker

The first step: start docker

service docker start

operation result:

Step two: Check docker mirror list

docker image

The third step: start mysql Mirror

docker run -itd -P mysql:5.6 bash

Wherein docker run is the command to start the container; I interactive operation, T is a terminal, D refers to running in the background,

-P means generates a random local port, used to map the mysql 3306port, mysql means run mysql mirror, the bash process of creating an interactive shell.

Step 4: Check docker image has been running

docker ps -a

Take a look at the list, there are no mysql

Related command:

service mysql status # View start-up state of mysql
docker run mysql # start mysql

 

Guess you like

Origin www.cnblogs.com/nanyuan/p/11260046.html