ivankrizsan / elastalert docker图像错误

时间:2017-07-25 06:05:52

标签: elasticsearch docker docker-compose elastalert

我正在使用compose将elastalert用作docker容器。 以下是我的dokcer-compose文件中的elastalert定义: elastalert:

image: ivankrizsan/elastalert
container_name: elastalert
restart: unless-stopped
privileged: true
links:
  - es:elasticsearchhost
ports:
  - "3030:3030"            
cap_add:
  - SYS_TIME
  - SYS_NICE
volumes:
  - /etc/elastalert/config:/opt/config
  - /etc/elastalert/rules:/opt/rules
  - /etc/elastalert/logs:/opt/logs
  - /etc/elastalert:/opt/elastalert
environment:
  - ELASTICSEARCH_HOST=es
  - ELASTICSEARCH_PORT=9200  

我收到了以下错误:

Container timezone not modified  
{  
"name" : "Stunner",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "jqqJxdQZRP6cLJPBd0Usdg",
"version" : {
"number" : "2.4.5",
"build_hash" : "c849dd13904f53e63e88efc33b2ceeda0b6a1276",
"build_timestamp" : "2017-04-24T16:18:17Z",
"build_snapshot" : false,
"lucene_version" : "5.5.4"
},  
"tagline" : "You Know, for Search"  
}  
Creating Elastalert index in Elasticsearch...  
Traceback (most recent call last):  
File "/usr/bin/elastalert-create-index", line 6, in <module>
from pkg_resources import load_entry_point  
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 3019, in   <module>
@_call_aside  
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 3003, in _call_aside
f(args, *kwargs)  
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 3032, in _initialize_master_working_set
working_set = WorkingSet._build_master()  
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 655, in _build_master
ws.require(requires)  
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 963, in require
needed = self.resolve(parse_requirements(requirements))  
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 849, in resolve
raise DistributionNotFound(req, requirers)  
pkg_resources.DistributionNotFound: The 'elastalert' distribution was not found and is required by the application 

1 个答案:

答案 0 :(得分:0)

我能够解决这个问题。 docker-compose配置对我有用:

elastalert:

image: ivankrizsan/elastalert

container_name: elastalert

restart: unless-stopped

privileged: true

links:
        - es:elasticsearchhost

cap_add:

 - SYS_TIME

 - SYS_NICE

volumes:     

  - /etc/elastalert/config:/opt/config

  - /etc/elastalert/rules:/opt/rules

  - /etc/elastalert/logs:/opt/logs      

environment:

  - ELASTICSEARCH_HOST=es

  - ELASTICSEARCH_PORT=9200