制作zipkin docker镜像
这里使用的zipkin知识基于内存的版本,没有接入外部存储
https://github.com/openzipkin/zipkin
https://github.com/openzipkin/brave
一个博客:https://www.cnblogs.com/haixiang/p/11568659.html
直接运行
java -jar zipkin-server-2.12.9-exec.jar
文档:
springboot admin:https://github.com/codecentric/spring-boot-admin
springcloud:https://spring.io/projects/spring-cloud
制作zipkin的Dockerfile
cd /home/docker/zipkin
ls
zipkin-server-2.12.9-exec.jar
jdk-8u144-linux-x64.tar.gz
Dockerfile:
FROM centos:7
MAINTAINER pader "bartggg@163.com"
RUN set -x \
&& mkdir -p /opt/zipkin \
&& cd /opt/zipkin \
&& mkdir -p logs \
&& cd logs \
&& touch start.out \
&& ln -sf /dev/stdout start.out \
&& ln -sf /dev/stderr start.out \
&& ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo '$TIME_ZONE' > /etc/timezone \
# 允许挂载该目录
VOLUME /opt/zipkin/logs
# 添加jdk、sentinel的jar包
ADD jdk-8u144-linux-x64.tar.gz /opt
ADD zipkin-server-2.12.9-exec.jar /opt/zipkin/zipkin-server.jar
# set environment
ENV BASE_DIR="/opt/zipkin" \
JAVA_HOME="/opt/jdk1.8.0_144" \
JAVA="/opt/jdk1.8.0_144/bin/java" \
JVM_XMS="512m" \
JVM_XMX="512m" \
JVM_XMN="256m" \
JVM_MS="32m" \
JVM_MMS="20m" \
TIME_ZONE="Asia/Shanghai" \
SERVER_PORT="9411"
ENV JAVA_OPT="-jar ${BASE_DIR}/zipkin-server.jar -server -Xms=${JVM_XMS} -Xmx=${JVM_XMX} -Xmn=${JVM_XMN} -XX:MetaspaceSize=${JVM_MS} -XX:MaxMetaspaceSize=${JVM_MMS} --server.port=${SERVER_PORT}"
WORKDIR $BASE_DIR
EXPOSE 9411
CMD echo "$JAVA ${JAVA_OPT}" > ${BASE_DIR}/logs/start.out && nohup $JAVA ${JAVA_OPT} >> ${BASE_DIR}/logs/start.out 2>&1 < /dev/null
构建镜像,并运行:
docker build -t bart/zipkin:2.12.9 .
# 查看镜像
docker images
# 运行镜像
docker run -d \
--name zipkin \
--restart always \
-p 9411:9411 \
-v /home/gwc/docker/zipkin:/opt/zipkin/logs \
bart/zipkin:2.12.9
# 测试
curl http://localhost:9411/zipkin/
# 导出镜像
docker save -o /home/gwc/docker/zipkin/zipkin.tar bart/zipkin:2.12.9
# 导入镜像
docker load -i /home/gwc/docker/zipkin/zipkin.tar