1、拉取远程mysql和wordpress镜像并启动起来使用
docker pull hub.c.163.com/library/mysql:latest
docker pull hub.c.163.com/library/wordpress:latest
2、 创建mysql 的 container (具体创建容器时的参数可以访问 https://hub.docker.com/_/mysql)
docker run -d –name mysql -p3306:3306 -v mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123 -e MYSQL_DATABASE=wordpress hub.c.163.com/library/mysql
3、创建 wordpress 的 container (具体创建容器时的参数可以访问 https://hub.docker.com/_/wordpress)
docker run -d -e WORDPRESS_DB_HOST=mysql:3306 –link mysql -p 8888:80 hub.c.163.com/library/wordpress
4、浏览器访问 http://192.168.18.151:8888 即可
原文链接:https://blog.csdn.net/lixinkuan328/article/details/103900087?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522168994674616800197073896%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=168994674616800197073896&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-17-103900087-null-null.268%5Ev1%5Ekoosearch&utm_term=docker%E3%80%81wordpress%E3%80%81wordpress%E5%BB%BA%E7%AB%99%E3%80%81wordpress%E4%B8%BB%E9%A2%98%E3%80%81%E5%AE%B9%E5%99%A8%E9%95%9C%E5%83%8F%E3%80%81