Home  >  Article  >  Database  >  Using docker to build mysql instance tutorial

Using docker to build mysql instance tutorial

零下一度
零下一度Original
2017-05-13 16:20:191555browse

Mysql server is currently a popular open source database server. Here is how to use docker to make a mysql database service

Pull a mysql image directly from the website

core @ localhost〜/ base $ docker pull dl.dockerpool.com:5000/mysql:5.7
拉取存储库dl.dockerpool.com:5000/mysql
e95cbb9f48ea:下载完成
511136ea3c5a:下载完成
5a7d9470be44:下载完成
feb755848a9a:下载完成
034656f0ad7b:下载完成
d30d97371f31:下载完成
06fcd079bef3:下载完成
2702d110a524:下载完成
d46d6a3cd040:下载完成
b6ce9f97ca75:下载完成
63c6cebccd5a:下载完成
b9e91c841f3b:下载完成
5bc8425e8dff:下载完成
2a35d8172e2d:下载完成
43279c8daf8e:下载完成
02c1bd631e20:下载完成
7ea4b0fe19cc:下载完成
core @ localhost〜/ base $ docker tag dl.dockerpool.com:5000/mysql:5.7 mysql:5.7
core @ localhost〜/ base $ docker图像
记录标签图像ID创建的虚拟大小
base / 163最新468d347c06bc 5小时前249.1 MB
dl.dockerpool.com:5000/mysql 5.7 e95cbb9f48ea 5天前258.6 MB
mysql 5.7 e95cbb9f48ea 5天前258.6 MB

Start the mysql container

core @ localhost〜/ base $ docker run --name db001 -p 3306:3306 -e MYSQL_ROOT_PASSWORD = admin -d mysql:5.7
#上面这条语句启动了一个名字叫db001的容器,他的root密码是admin,映射宿主主机的端口3306,这些都是手工指定的。
core @ localhost〜/ base $ docker ps
CONTAINER ID图像命令创建的状态名称
fb4b9ab6a2ba dl.dockerpool.com:5000/mysql:5.7“/entrypoint.sh mysq 2秒ago Up 2 seconds 0.0.0.0:3306->3306/tcp

So we can use the mysql server. The next chapter will introduce how to open the tomcat container and link to The database container of db001

[Related recommendations]

1. Special recommendation:"php programmer toolbox ”V0.1 version download

2. Free mysql online video tutorial

3. Those things about database design

The above is the detailed content of Using docker to build mysql instance tutorial. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn