[docker] docker-compose 管理lnmp容器

1. docker-compose介绍和命令详解

 [链接1] https://yeasy.gitbooks.io/docker_practice/content/compose/

 [链接2] https://www.jianshu.com/p/658911a8cff3

2.编写docker-compose.yml, #docker-compose config 验证书写格式

networks:
  lnmp:
    driver: bridge
services:
  mysql:
    container_name: mysql
    environment:
      MYSQL_ROOT_PASSWORD: '123456'
    image: mysql
    networks:
      lnmp: null
    ports:
    - 13306:3306/tcp
    volumes:
    - E:\Docker\mydata:/var/lib/mysql:rw
    - E:\Docker\myconf:/etc/mysql:rw
  nginx:
    container_name: nginx
    depends_on:
    - mysql
    - php
    image: nginx:v1
    networks:
      lnmp: null
    ports:
    - 8888:80/tcp
    volumes:
    - E:\Docker\wwwroot:/home/wwwroot:rw
    - E:\Docker\wwwlogs:/usr/local/nginx/logs:rw
    - E:\Docker\wwwconf:/usr/local/nginx/conf:rw
  php:
    container_name: php
    image: php:v1
    networks:
      lnmp: null
    volumes:
    - E:\Docker\wwwroot:/home/wwwroot:rw
    - E:\Docker\phplogs:/usr/local/php/var/log:rw
    - E:\Docker\phpconf:/usr/local/php/etc:rw
version: '2.0'
volumes:
  mysql:
    driver: local

相关推荐