"Series 6" using Dockerfile to create a CentOS docker image with mysql5.7 1

Source: Internet
Author: User
Tags docker ps docker run

1. 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:

[[email protected] ~]# docker pull mysql:5.75.7: pulling from library/ mysqlad74af05f5a2: pull complete 0639788facc8: pull complete de70fa77eb2b:  pull complete 724179e94999: pull complete 50c77fb16ba6: pull complete  D51f459239fb: pull complete 937bbdd4305a: pull complete 35369f9634e1: pull  complete f6016aab25f1: Pull complete 5f1901e920da: Pull complete  fdf808213c5b: pull complete digest: sha256 : 96edf37370df96d2a4ee1715cc5c7820a0ec6286551a927981ed50f0273d9b43status: downloaded newer image  for mysql:5.7

2, first to see what the image of the machine, the command is as follows:

Docker images
[[email protected] ~]# docker imagesrepository           TAG                  image id            created              SIZEmysql                5.7                  c73c7527c03a         8 days ago           412mbhello-world         latest               1815c82652c0         7 weeks ago         1.84kbjava                 latest               d23bdf5b1b1b        6 months ago         643MBlearn/tutorial      latest               a7876479f1aa         4 years ago         128mb

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

Docker run--name mysql5.7-p 3306:3306-e mysql_root_password=123456-d mysql:5.7

Note that the container name here is: Mysql5.7,mysql root user password is: 123456, 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:

9238d9feb10a0c553d950451add144727b659a0972ccf04d7c59c3bfa198ed20

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

[[email protected] ~]# docker ps container id         IMAGE                COMMAND                   CREATED             STATUS               PORTS                      names9238d9feb10a        mysql:5.7             "Docker-entrypoint ..."    12 seconds ago       up 9 seconds        0.0.0.0:3306- >3306/tcp   mysql5.7[[email protected] ~]# 

5. The use of MySQL tools, such as NAVICAT connection success is as follows:


"Series 6" using Dockerfile to create a CentOS docker image with mysql5.7 1

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.