部署:
mkdir my_wordpress
cd my_wordpress/
vim docker-compose.yml
version: <span class="token string">"3.9"</span> services: db: image: mysql:5.7 volumes: - db_data:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: somewordpress MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress wordpress: depends_on: - db image: wordpress:latest volumes: - wordpress_data:/var/www/html ports: - <span class="token string">"8000:80"</span> restart: always environment: WORDPRESS_DB_HOST: db WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress WORDPRESS_DB_NAME: wordpress volumes: db_data: <span class="token punctuation">{<!-- --></span><span class="token punctuation">}</span> wordpress_data: <span class="token punctuation">{<!-- --></span><span class="token punctuation">}</span>version: <span class="token string">"3.9"</span> services: db: image: mysql:5.7 volumes: - db_data:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: somewordpress MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress wordpress: depends_on: - db image: wordpress:latest volumes: - wordpress_data:/var/www/html ports: - <span class="token string">"8000:80"</span> restart: always environment: WORDPRESS_DB_HOST: db WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress WORDPRESS_DB_NAME: wordpress volumes: db_data: <span class="token punctuation">{<!-- --></span><span class="token punctuation">}</span> wordpress_data: <span class="token punctuation">{<!-- --></span><span class="token punctuation">}</span>version: "3.9" services: db: image: mysql:5.7 volumes: - db_data:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: somewordpress MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress wordpress: depends_on: - db image: wordpress:latest volumes: - wordpress_data:/var/www/html ports: - "8000:80" restart: always environment: WORDPRESS_DB_HOST: db WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress WORDPRESS_DB_NAME: wordpress volumes: db_data: {} wordpress_data: {}
docker-compose up -d
- 访问http://localhost:8000即可搭建
问题解决
1、创建一个uploads.ini
文件
file_uploads <span class="token operator">=</span> On memory_limit <span class="token operator">=</span> 500M upload_max_filesize <span class="token operator">=</span> 500M post_max_size <span class="token operator">=</span> 500M max_execution_time <span class="token operator">=</span> <span class="token number">600</span>file_uploads <span class="token operator">=</span> On memory_limit <span class="token operator">=</span> 500M upload_max_filesize <span class="token operator">=</span> 500M post_max_size <span class="token operator">=</span> 500M max_execution_time <span class="token operator">=</span> <span class="token number">600</span>file_uploads = On memory_limit = 500M upload_max_filesize = 500M post_max_size = 500M max_execution_time = 600
2、在docker-compose.yml
中挂载
volumes: - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.inivolumes: - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.inivolumes: - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
如图:
3、停掉容器docker-compose down
4、启动docker-compose up -d --build
再次上传就行了
原文链接:https://blog.csdn.net/m0_46089735/article/details/125075312?ops_request_misc=&request_id=a33692c262e541fbad46a1a655f78274&biz_id=&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~koosearch~default-30-125075312-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
© 版权声明
声明📢本站内容均来自互联网,归原创作者所有,如有侵权必删除。
本站文章皆由CC-4.0协议发布,如无来源则为原创,转载请注明出处。
THE END