How to install MySQL on Linux docker

Source: Internet
Author: User
Tags docker ps docker run

1, install Docker, online a bunch, here does not elaborate.

2. After entering Linux, use the docker command to download MySQL, commands such as:

Docker Pull mysql:5.7

After you run the command, the following log is displayed:

5.7:pulling from MySQL
4c8cbfd2973e:pull Complete
60c52dbe9d91:pull Complete
C2b0136be90f:pull Complete
273cd71eacf0:pull Complete
543ff72402d8:pull Complete
F928e22e58b0:pull Complete
2d1023ecaed4:pull Complete
059dbbef4dd8:pull Complete
Ac0ee0367a32:pull Complete
A9057a689e83:pull Complete
5191ddfc3b01:pull Complete
6e2ce31eb835:pull Complete
099dc92e9b15:pull Complete
7b4030a6b20b:pull Complete
Fdb9c2185fc2:already exists
Mysql:5.7:the image You is pulling has been verified. Important:image verification is a tech-preview feature and should not being relied on to provide security.
Digest:sha256:d00f3f3cd30d0e8ad9bdf8ba61729ee1a4b6fe84a0fbb95f07dc2668a4cb5d08
status:downloaded newer image for mysql:5.7

The download takes a while and after the download is complete, launch the Docker container.

3, first to see what the image of the machine, the command is as follows: Docker Images

The following logs are then printed:

   repository          tag       & nbsp         IMAGE ID            created           & nbsp VIRTUAL SIZE
   mysql               5.7                 FDB9C2185FC2        9 days ago          321.9 MB
&nb Sp  csphere/csphere     0.11.2              6d983828b938     &NBS P  8 weeks ago        

4. Then launch our MySQL Docker container with the following command:

Docker run--name db001-p 3306:3306-e mysql_root_password=mytest-d mysql:5.7

Note that the container name here is: Db001,mysql root user password is: mytest, map host child port 3306 to container Port 3306, warehouse name MySQL and tag (tag) uniquely determine the image to be specified, In fact, if there is only one MySQL is also necessary to tag, the result of executing the command returned is:

a40c6e58afbda0199111a2a2ef0af7e8dd9be057a610ca5f4f30aa782a5d9155

5. View all containers that have been run, such as: Docker PS

The results returned are:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
A40C6E58AFBD mysql:5.7 "/entrypoint.sh mysq seconds ago up seconds 0.0.0.0:3306-& Gt;3306/tcp db001
512013F5BD3A csphere/csphere:0.11.2 "/bin/csphere-init-10 days ago up ten days Csphere-agent
631A4F91B2FB csphere/csphere:0.11.2 "/bin/csphere-init-10 days ago up ten days 8086/tcp, 2701 7/TCP, 0.0.0.0:1016->80/tcp Csphere-controller

Tools that use MySQL, such as the Navicat connection, are successful.

Here we did not make their own image, the direct use of the Internet has been, started from the Docker pull dl.dockerpool.com:5000/mysql:5.7 path on the pulling myql image, the result is not successful, so directly using the above said Docker pull mysql:5.7, no technical content, for beginners to use it.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

How to install MySQL on Linux docker

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.