Docker-compose为版本2重写第1版的文件

时间:2016-12-15 06:41:40

标签: docker docker-compose

我有一个elk docker-compose文件,我认为无法在我的服务器上运行,因为docker-compose版本太旧...

$ docker-compose -version
docker-compose version 1.6.2, build 4d72027

这是我的docker-compose文件......

version: '2'
services:
    elasticsearch:
      image: elasticsearch:5
      command: elasticsearch
      environment:
        # This helps ES out with memory usage
        - ES_JAVA_OPTS=-Xmx1g -Xms1g
      volumes:
        # Persist elasticsearch data to a volume
        - elasticsearch:/usr/share/elasticsearch/data
        # Extra ES configuration options
        - ./es/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
      ports:
        - "9200:9200"
        - "9300:9300"

    logstash:
      image: logstash:5
      command: logstash -w 4 -f /etc/logstash/conf.d/logstash.conf
      environment:
        # This helps Logstash out if it gets too busy
        - LS_HEAP_SIZE=2048m
      volumes:
        # volume mount the logstash config
        - ./logstash/logstash.conf:/etc/logstash/conf.d/logstash.conf
        - /Users/rriviere/workspace/parks-dpe/activities-api-v1/app-logs/:/tmp/app-logs
      ports:
        # GELF port for Docker logs
        - "12201:12201/udp"
        # UDP port for syslogs
        - "5000:5000/udp"
        # Default TCP port
        - "5001:5001"
      links:
        - elasticsearch

    kibana:
      image: kibana:5
      environment:
        # Point Kibana to the elasticsearch container
        - ELASTICSEARCH_URL=http://elasticsearch:9200
      ports:
        - "5601:5601"
      links:
        - elasticsearch

    kopf:
      image: rancher/kopf:v0.4.0
      ports:
        - "8080:80"
      environment:
        KOPF_ES_SERVERS: "elasticsearch:9200"
      links:
        - elasticsearch

volumes:
  elasticsearch:

虽然我不是在寻找一个确切的答案,但有人可以帮助我创建自己的docker撰写v1文件所需要的东西。

感谢

1 个答案:

答案 0 :(得分:0)

您最好查看文档以获取更多详细信息,但只是查看您的文件,我认为如果删除以下行,那么您就可以了:

version: '2'
services:

版本2有一些我在你的情况下看不到的附加功能,所以你与v1非常兼容。