1.新建一个项目目录
root@iZ2ze0ht45qn4m8m1wjfdrZ:~# mkdir my_wordpressroot@iZ2ze0ht45qn4m8m1wjfdrZ:~# lsgrid_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: wordpressvolumes: dbdata:
4.运行docker-compose up -d
admin@iZ2ze0ht45qn4m8m1wjfdrZ:~/Python-3.6.0/my_wordpress$ sudo docker-compose up -dsudo: unable to resolve host iZ2ze0ht45qn4m8m1wjfdrZCreating network "my_wordpress_default" with the default driverCreating volume "my_wordpress_dbdata" with default driverPulling db (mysql:5.7)...5.7: Pulling from library/mysqlDigest: sha256:691c55aabb3c4e3b89b953dd2f022f7ea845e5443954767d321d5f5fa394e28cStatus: Downloaded newer image for mysql:5.7Creating my_wordpress_db_1 ... doneCreating my_wordpress_wordpress_1 ... doneadmin@iZ2ze0ht45qn4m8m1wjfdrZ:~/Python-3.6.0/my_wordpress$
4.在浏览器中打开wordpress,使用yml文件配置的端口8000:localhost:8000
5.设置用户名及其他信息,安装wordpress
6. 使用用户名和密码登录wordpress