使用docker-compose安装wordpress

1.新建一个项目目录
root@iZ2ze0ht45qn4m8m1wjfdrZ:~# mkdir my_wordpress
root@iZ2ze0ht45qn4m8m1wjfdrZ:~# ls
grid_demo.py  my_wordpress  result.csv  result_gip.csv  result_gzip.csv  shj_test

2.进入my_wordpress目录

root@iZ2ze0ht45qn4m8m1wjfdrZ:~# cd my_wordpress/
root@iZ2ze0ht45qn4m8m1wjfdrZ:~/my_wordpress#

3.新建一个yml文件vi docker-compose.yaml,包含以下内容:

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:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: wordpress

volumes:
    dbdata:

4.运行docker-compose up -d

admin@iZ2ze0ht45qn4m8m1wjfdrZ:~/Python-3.6.0/my_wordpress$ sudo docker-compose up -d
sudo: unable to resolve host iZ2ze0ht45qn4m8m1wjfdrZ
Creating network "my_wordpress_default" with the default driver
Creating volume "my_wordpress_dbdata" with default driver
Pulling db (mysql:5.7)...
5.7: Pulling from library/mysql
Digest: sha256:691c55aabb3c4e3b89b953dd2f022f7ea845e5443954767d321d5f5fa394e28c
Status: Downloaded newer image for mysql:5.7
Creating my_wordpress_db_1 ... done
Creating my_wordpress_wordpress_1 ... done
admin@iZ2ze0ht45qn4m8m1wjfdrZ:~/Python-3.6.0/my_wordpress$

4.在浏览器中打开wordpress,使用yml文件配置的端口8000:localhost:8000

kiHjr.md.png

5.设置用户名及其他信息,安装wordpress

ki24J.md.png

6. 使用用户名和密码登录wordpress

kixHl.md.png

posted @ 2018-04-17 11:31  sandy.sun  阅读(1142)  评论(0编辑  收藏  举报

友情链接 虫师的blog  乙醇的blog  测试教程网  重定向科技  测试学习小组