mkdir my_wordpress
cd my_wordpress
touch docker-compose.yml;vi docker-compose.yml
添加如下内容:
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
dbdata:/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:
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
volumes:
dbdata:
images 镜像名
restart 指定版本
ports 80为镜像端口, 映射的8000为主机端口
environment 环境配置,数据库用户、密码等
docker-compose up -d
https://docs.docker.com/compose/wordpress/#bring-up-wordpress-in-a-web-browser
手机扫一扫
移动阅读更方便
你可能感兴趣的文章