PHP.and.MySQL.Create.Modify.Reuse
PHP&MySQL范例精解_创建、修改、重用-docker环境搭建-2.准备数据库
准备数据库
准备数据库容器卷
docker create --name virhuiai-mysql57-container mysql:5.7
创建数据库容器
docker run -p 3306:3306 \
--volumes-from virhuiai-mysql57-container \
--name virhuiai-mysql57 \
-e MYSQL_ROOT_PASSWORD=wb6Y7CTgA \
-d \
mysql:5.7
加入网络
忘记加入新建的网络了,加入:
docker network connect virhuiai_nw virhuiai-mysql57
创建网络virhuiai_nw的请看前一篇
此时查看virhuiai_nw
docker network inspect virhuiai_nw
localhost:~ jjkkll$ docker network inspect virhuiai_nw
[
{
"Name": "virhuiai_nw",
...
"Containers": {
"0234a685bbc34cfd8f49bbce5a04d4f71b4d72f88b46f1e39718f35fa746b582": {
"Name": "virhuiai-mysql57",
...
"MacAddress": "02:42:ac:12:00:02",
"IPv4Address": "172.18.0.2/16",
"IPv6Address": ""
}
},
..
}
]
可以看到virhuiai-mysql57已经在Containers里面了
网友评论