阿里云Ubuntu18安装Docker环境,搭建WordPress

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%2522168666919616800180631443%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=168666919616800180631443&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-26-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

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享