美文网首页
docker搭建wordpress

docker搭建wordpress

作者: zwb_jianshu | 来源:发表于2019-07-24 20:38 被阅读0次

    一、安装docker-compose包

     yum install docker-compose.noarch -y
    

    二、导入wordpress镜像

    docker load -i wordpress-latest.tar.gz
    

    三、创建docker-compose文件

    mkdir /data/docker-compose/wordpress
    vim docker-compose.yaml 
    version: '3'
    services:
       db:
         image: mysql:5.7
         volumes:
           - db_data:/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
         volumes:
           - web_data:/var/www/html
         ports:
           - "80:80"
         restart: always
         environment:
           WORDPRESS_DB_HOST: db:3306
           WORDPRESS_DB_USER: wordpress
           WORDPRESS_DB_PASSWORD: wordpress
    volumes:
        db_data:
        web_data:
    

    四、启动docker-compose

    docker-compose up
    docker-compose up  -d
    

    五、浏览器访问测试

    image.png

    相关文章

      网友评论

          本文标题:docker搭建wordpress

          本文链接:https://www.haomeiwen.com/subject/wfnfrctx.html