srvz/node:12-qconfcurl -L https://github.com/Qihoo360/QConf/archive/1.2.1.tar.gz -o QConf-1.2.1.tar.gz
FROM node:12.18.3
RUN set -ex \
&& sed -i -r 's/(deb|security).debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list \
&& apt-get -y update \
&& apt-get install -y --no-install-recommends cmake \
&& rm -rf /var/lib/apt/lists/*
COPY docker-entrypoint.sh /usr/local/bin/
ADD QConf-1.2.1.tar.gz /tmp
RUN cd /tmp/QConf-1.2.1/ \
&& mkdir build && cd build \
&& cmake .. && make && make install \
&& cp /usr/local/qconf/lib/libqconf.so /usr/lib/ \
&& chmod +x /usr/local/bin/docker-entrypoint.sh \
&& rm -rf /tmp/QConf-1.2.1
docker-entrypoint.sh#!/bin/bash
set -e
if [[ -n "$ZK_CLUSTER" ]]; then
QCONF_CONF_PATH="/usr/local/qconf/conf"
echo "zookeeper.cluster=$ZK_CLUSTER" > $QCONF_CONF_PATH/idc.conf
echo "cluster" > $QCONF_CONF_PATH/localidc
if [[ "$DAEMON_MODE" -eq 0 ]]; then
sed -i 's/daemon_mode=1/daemon_mode=0/g' $QCONF_CONF_PATH/agent.conf
fi
/bin/bash /usr/local/qconf/bin/agent-cmd.sh start
fi
if [[ "${1#-}" != "${1}" ]] || [[ -z "$(command -v "${1}")" ]]; then
set -- node "$@"
fi
exec "$@"
指定 ZK_CLUSTER 则启动 qconf, 默认会开启 daemon_mode,指定环境变量 DAEMON_MODE=0 可单独启动 qconf
docker run -d --name qconf --ipc=shareable -e DAEMON_MODE=0 -e ZK_CLUSTER=`(ifconfig eth0 2>/dev/null || ifconfig en0 2>/dev/null) | awk '$1 == "inet" {print $2}'`:22181 srvz/node:12-qconf
docker exec -it qconf qconf get_conf /test
# or
docker run -it --rm --ipc=container:qconf \
srvz/node:12-qconf qconf get_conf /healthchecks/test
Content type
Image
Digest
Size
49.8 MB
Last updated
over 5 years ago
docker pull srvz/node:12.18-slim-qconf