我在使用consul+prometheus+registrator时候,发现原本的gliderlabs/registrator :v7 ,在传递command的时候,指定ip地址是个麻烦的事情,特别是在大量部署的时候。 于是,我在原有的镜象中添加了脚本,并打包:
When I used consul+prometheus+registrator, I found the original gliderlabs/registrator :v7. When passing the command, specifying the ip address is a hassle, especially when deploying a lot. So, I added a script to the original image and packaged it:
#!/bin/sh
# maintainer="linuxea.com"
NDIP=`ip a s ${NETWORK_DEVIDE:-eth0}|awk '/inet/{print $2}'|sed -r 's/\/[0-9]{1,}//')`
exec /bin/registrator -ip="${NDIP}" ${ND_CMD:--internal=false} consul://${NDIPSERVER_IP:-consul}:8500
so ,你需要传递几个变量才能使用这个镜象
NETWORK_DEVIDE: 网络名称
NDIPSERVER_IP:consul server ip
ND_CMD: 参数
So , you need to pass a few variables to use this image
NETWORK_DEVIDE: network name
NDIPSERVER_IP:consul server ip
ND_CMD: parameter
示例:
Example:
environment:
- REGISTRATOR_BIND_INTERFACE=eth0
- NETWORK_DEVIDE=eth0
- NDIPSERVER_IP=172.25.250.249
- ND_CMD=-internal=false
Content type
Image
Digest
Size
6.6 MB
Last updated
almost 8 years ago
docker pull marksugar/registrator:v7.1