docker-compose 一键安装wordpress
Published on Aug. 22, 2023, 12:11 p.m.
我们使用这个docker进行部署
https://hub.docker.com/_/wordpress
docker-compose.yml
version: '3.1'
services:
wordpress:
image: wordpress
restart: always
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: exampleuser
WORDPRESS_DB_PASSWORD: examplepass
WORDPRESS_DB_NAME: exampledb
ports:
- 8082:80
- 8444:443
volumes:
- wordpress:/var/www/html
# - "/home/terry/PycharmProjects/wp_dev/:/var/www/html/"
db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
MYSQL_PASSWORD: examplepass
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- db:/var/lib/mysql
volumes:
wordpress:
db:
安装部署
docker-compose up -d
查看启动
docker ps
进入对应id
docker exec -it 6eced80d20ce bash
管理数据库可以在代码里加入个adminer
https://www.adminer.org/
插件开发可以安装
对于root用户运行–allow-root
wp plugin search yoast –allow-root