docker-compose配置文件

# yaml 配置
 # 指定 compose 文件的版本
version: '3'
services:
  redis:
    # 指定 docker 镜像, 可以是远程仓库镜像、本地镜像
    image: redis
    ports:
      - "6379:6379"
    networks:
      - app
  nginx:
    image: nginx
    # 建立宿主机和容器之间的端口映射关系
    ports:
      - 80:80
      - "443:443"
   # 定义容器和宿主机的卷映射关系, 
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./nginx/logs:/var/log/nginx
      - ./nginx/html:/usr/share/nginx/myhtml
      - ./nginx/crt:/etc/nginx/crt  
    # 将容器加入指定网络
    networks:
      - app
  es:      
    image: es_ik:1.2 
    ports:
      - "9200:9200"
      - "9300:9300"     
    networks:
      - app     
  mongo-connector:
    image: mongo_connector:1.6  
    volumes: 
      - ./mongo-connect/mongo_es_config_3_20.json:/usr/local/mongo-connector/config/mongo_es_config_3_20.json
      - ./mongo-connect/log:/usr/local/mongo-connector/log  
    # 覆盖容器启动后默认执行的命令, 支持 shell 格式和 [] 格式
    command: 
      - /bin/sh
      - -c
      - | 
          mongo-connector -c /usr/local/mongo-connector/config/mongo_es_config_3_20.json   
    # 定义容器启动顺序 
    depends_on:
      - es 
    networks:
      - app      
  es_head:
    image: mobz/elasticsearch-head:5
    ports:
      - "9000:9100"
    networks:
      - app
    depends_on:
      - es     
  project:
    image: adoptopenjdk/openjdk8
    volumes: 
      - ./workapp:/usr/local/workapp
    ports:
      - 8080:8080    
    command:
      - /bin/sh
      - -c
      - |
          sh /usr/local/workapp/mysh.sh    
    depends_on:
      - es
      - redis
      - nginx  
# 定义 networks 信息    
networks:
  app:
    external: true   

你可能感兴趣的:(docker-compose配置文件)