容器編排docker-compose
阿新 • • 發佈:2019-03-11
host user 5.7 yun ase environ ces aliyun .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:
容器編排docker-compose