使用docker-compose搭建wordpress

使用docker-compose搭建wordpress非常简单

安装docker

配置docker的yum源

cat >> /etc/yum.repos.d/docker.repo <<EOF [docker-repo] name=Docker Repository baseurl=http://mirrors.aliyun.com/docker-engine/yum/repo/main/centos/7 enabled=1 gpgcheck=0 EOF

yum安装docker

# yum install -y docker # systemctl start docker # systemctl enable docker

安装docker-compose

安装

# sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose # sudo chmod +x /usr/local/bin/docker-compose 

写docker-compose的yml文件

version: "3" services: db: image: mysql:5.7 volumes: - db_data:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: P@ssW0rd MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress123456 wordpress: depends_on: - db image: wordpress:latest ports: - "8888:80" restart: always environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress123456 volumes: db_data: 

启动

# docker-compose up -d

启动过后,在浏览器输入:http://IP:8888 就可以进行博客的创建了。

转载于:https://blog.51cto.com/7834466/2342592

原文链接:https://blog.csdn.net/weixin_33904756/article/details/92645406?ops_request_misc=&request_id=aab9818f16734c888218be7080757f1b&biz_id=&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~koosearch~default-19-92645406-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

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