如何构建一个新的docker镜像并启动容器

时间:2015-10-12 07:53:37

标签: docker rabbitmq logstash dockerfile

我是Docker的新手。我想将rabbitmq消息推向弹性。

现在我有两个logstash-indexer图片:ctdcto23:5000/logstash-indexer:latestctdcto23:5000/logstash-indexer:1.0.0-rc3。它们之间的差异是indexer.conf。前者是

    input { 
        redis {
            host => ''
            port => 
            key => ''
            password => ''
            data_type => 'list'
            tags => ['service-log']
        }
        rabbitmq {
            host => ''
            user => ''
            password => ''
            port => 5672
            queue => 'security audit'
            exchage => 'exchange'
            key => 'security audit'
            durable => 'true'
        }
    }
而后者省略了rabbitmq。 yaml文件如下:


    redis:
      image: ctdcto23:5000/redis:1.0.0-rc1
      restart: always
      ports:
       - "6379:6379"

    elasticsearch:
      image: ctdcto23:5000/elasticsearch:1.0.0-rc3
      restart: always
      ports:
       - "9200:9200"
       - "9300:9300"
      volumes:
       - /var/local/esdata:/usr/share/elasticsearch/data
      command: elasticsearch -Des.cluster.name="xx-cluster" -Des.node.name="xx-1"

    kibana:
      image: ctdcto23:5000/kibana:4.0.3
      restart: always
      links:
       - elasticsearch
      ports:
       - "5601:5601"

    logstash-indexer:
      image: ctdcto23:5000/logstash-indexer:1.0.0-rc3
      restart: always
      links:
       - redis
       - elasticsearch
      environment:
       - OPTS=--verbose

使用Dockfile构建映像:

    FROM ctdcto23:5000/logstash:latest
    MAINTAINER xxx

    # Add a directory to process setup scripts for the container
    RUN mkdir -p /opt/logstash/conf /opt/logstash/patterns

    COPY indexer.conf /opt/logstash/conf/
    COPY patterns/* /opt/logstash/patterns/
    COPY docker-entrypoint.sh /
    RUN chmod +x /docker-entrypoint.sh

    ENTRYPOINT ["/docker-entrypoint.sh"]
    CMD ["logstash"]

问题在于,当我构建新图像并使用yaml文件启动它时。容器状态始终重新启动,无法进入容器。

0 个答案:

没有答案