运维开发网

容器编排docker-compose

运维开发网 https://www.qedev.com 2020-06-13 17:28 出处:网络 作者:运维开发网整理
安装: curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo yum install -y python2-pip pip install docker-compose 检查是否安装成功 docker-compose -v docker-compose.yml文件示例: vi docker-com
安装:

curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum install -y python2-pip
pip install docker-compose

检查是否安装成功

docker-compose -v

docker-compose.yml文件示例:

vi docker-compose.yml

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"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
volumes:
    db_data:
    web_data:
0

精彩评论

暂无评论...
验证码 换一张
取 消