PHP.and.MySQL.Create.Modify.Reuse
PHP&MySQL范例精解_創(chuàng)建嗡善、修改、重用-docker環(huán)境搭建-2.準(zhǔn)備數(shù)據(jù)庫
準(zhǔn)備數(shù)據(jù)庫
準(zhǔn)備數(shù)據(jù)庫容器卷
docker create --name virhuiai-mysql57-container mysql:5.7
創(chuàng)建數(shù)據(jù)庫容器
docker run -p 3306:3306 \
--volumes-from virhuiai-mysql57-container \
--name virhuiai-mysql57 \
-e MYSQL_ROOT_PASSWORD=wb6Y7CTgA \
-d \
mysql:5.7
加入網(wǎng)絡(luò)
忘記加入新建的網(wǎng)絡(luò)了,加入:
docker network connect virhuiai_nw virhuiai-mysql57
創(chuàng)建網(wǎng)絡(luò)virhuiai_nw的請(qǐng)看前一篇
此時(shí)查看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已經(jīng)在Containers里面了