1、安装docker和docker-compose
apt-get update apt-get upgrade apt-get install vim sudo apt install docker.io systemctl start docker systemctl enable docker docker --version useradd -m -s /bin/bash 账户名 passwd 密码 apt install docker-compose docker-compose --version reboot/shutdown -r now docker exec -it 9fbe362214a6(容器Id) /bin/bash
2、更改镜像地址
vim /etc/docker/daemon.json systemctl restart docker
3、编写docker-compose
mkdir my_wordpress cd my_wordpress vim docker-compose.yml
version: '3.3' 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 ports: - "8000:80" restart: always environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress WORDPRESS_DB_NAME: wordpress volumes: db_data: {}
启动容器
docker-compose up -d
4、修改文件上传限制(默认2M)
https://blog.csdn.net/j84491135/article/details/105977073 docker exec -it 容器名/容器ID /bin/bash cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini vim /usr/local/etc/php/php.ini
重点注意下面三个参数
upload_max_filesize = 200M post_max_size = 250M memory_limit = 500M
然后重启容器
docker-compose stop docker-compose up -d
最后:
云服务器Docker容器Mysql无法被远程访问原因汇总
原文链接:https://blog.csdn.net/qq_32958797/article/details/107322080?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522168623078216800213057985%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=168623078216800213057985&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-20-107322080-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
© 版权声明
声明📢本站内容均来自互联网,归原创作者所有,如有侵权必删除。
本站文章皆由CC-4.0协议发布,如无来源则为原创,转载请注明出处。
THE END