我想自动运行多个容器并创建一些东西,
但是一些图像,例如swarm,会在跑步或开始后自动停止.
我已经尝试过了
docker run -d swarm
docker run -d swarm /bin/bash tail -f /dev/null
docker run -itd swarm bash -c "while true; do sleep 1; done"
Run Code Online (Sandbox Code Playgroud)
但'docker ps'什么都没显示,我试着通过输入以下内容来构建Dockerfile:
FROM swarm
ENTRYPOINT ["echo"]
Run Code Online (Sandbox Code Playgroud)
并且图像不会运行,并显示错误消息:
docker: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"echo\\\": executable file not found in $PATH\"\n".
Run Code Online (Sandbox Code Playgroud)
我无法理解这个错误......我怎么能让swarm容器运行..?
(抱歉,我的英语不好))
我需要像使用 XPOST 一样存储唯一的自动 ID
因为每次启动程序时,数据都会被覆盖。
但是,我找不到在Python中自动生成id的示例
您能告诉我是否有什么好的例子吗?
我的代码:
def saveES(output,es):
bodys=[]
i=0
while i<len(output)-1: #output[len(output)-1] is space
json_doc=json.dumps(output[i])
body = {
"_index":"crawler",
"_type":"typed",
"_id":saveES.counter,
"_source":json_doc
}
i+=1
bodys.append(body)
saveES.counter+=1
helpers.bulk(es,bodys)
Run Code Online (Sandbox Code Playgroud) 我想在elasticsearch中提取数据
我的功能是这样的:
##Using regex to get the image name.
#it is inefficient to fetch them one by one using doc['hits']['hits'][n]['_source']['docker_image_short_name']
#because thousands of documents are stored per images
regex = "docker_image_short_name': u'(.+?)'"
pattern=re.compile(regex)
query={
"query":{
"bool":{ "must":[{"range":{"@timestamp":{"gt":vulTime}}}] }
}
}
page = es.search(index='crawledframe-*', body = query, scroll='1m', size=1000)
sid = page['_scroll_id']
num_page = page['hits']['total']
imglist=[]
while num_page > 0:
print num_page
print vulTime
imgs = re.findall(pattern, str(page))
imglist += imgs
page = es.scroll(scroll_id = sid, scroll = '1m')
num_page = …Run Code Online (Sandbox Code Playgroud) 我正在尝试在python中使用一些正则表达式
re.compile('in versions: (.+?) of '+name+' ')
Run Code Online (Sandbox Code Playgroud)
并且,如果名称为“ libcrypto ++”,则导致多次重复错误
我怎么只能在字符串中处理它?