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=&request_id=9630ef596e3b452f8c4e479ce176baa8&biz_id=&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~koosearch~default-4-103900087-null-null.268%5Ev1%5Econtrol&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