1. 下载docker镜像
docker pull wordpress docker pull mysql:5.6
查看镜像列表
docker image ls
2. 生成容器
开启mysql容器,密码设置为123456:
docker run --name w-mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6
然后进入mysql容器创建个wordpress的数据库:
docker exec -it wordpress-mysql mysql -uroot -p 123456 create database wordpress;
接下来在启动wordpress容器前准备一个文件uploads.ini
vim uploads.ini file_uploads = On memory_limit = 64M upload_max_filesize = 64M post_max_size = 64M max_execution_time = 600
接下来再启动wordpress,并把我们的uploads.ini加载到容器,这样就使wordpress容器本身配置上传大小限制从2M变成64M了:
docker run --name w-wordpress --link w-mysql:db -v /root/docker/wordpress/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini -p 80:80 -d wordpress:latest
3. 浏览器中进行配置
在地址栏输入服务器的公网地址,得到如下页面:
按下图进行配置:
然后登录进入后台页面,可以更换主题,调整布局等。
参考链接:链接
原文链接:https://blog.csdn.net/super_carry/article/details/121746633?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522168994567316800182722850%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=168994567316800182722850&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-10-121746633-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