1.首先下载mysql镜像和wordpress镜像
1
2
|
[root@kangvcar ~] # docker pull hub.c.163.com/library/mysql:latest [root@kangvcar ~] # docker pull hub.c.163.com/library/wordpress:latest |
2.查看本地镜像列表
1
2
3
4
|
[root@kangvcar ~] # docker images repository tag image id created size hub.c.163.com /library/wordpress latest ca96afcfa242 4 weeks ago 405.7 mb hub.c.163.com /library/mysql latest 9e64176cd8a2 8 weeks ago 407.1 mb |
3.用mysql镜像启动mysql容器
1
2
|
[root@kangvcar ~] # docker run --name mysql_wordpress -e mysql_root_password=000000 -d hub.c.163.com/library/mysql:latest 35f82ce4a617575356046439fd0dbb2cdc369c4332760d375774f0041bc93e64 |
4.用wordpress镜像启动wordpress容器,并link到上一步创建的mysql_wordpress容器
1
2
|
[root@kangvcar ~] # docker run --name wordpress --link mysql_wordpress:mysql_wordpress -p 80:80 -d hub.c.163.com/library/wordpress:latest 2b1b81df9749f637ff3ec8534489657cc8d39b54202e260fdef9195028e4ea08 |
5.访问
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。
原文链接:https://blog.csdn.net/kangvcar/article/details/73497425