一:简介
dubbo-admin是dubbo框架的管理平台。
二: 创建继续镜像
Dockerfile
FROM fangjipu/jdk8:8
RUN yum -y install epel-release
RUN mkdir /app
ADD tomcat8 /app/tomcat8
ADD docker-entrypoint.sh /app
EXPOSE 8080 8443
WORKDIR /app
ENTRYPOINT ["sh", "docker-entrypoint.sh"]
入口文件:docker-entrypoint.sh
#!/bin/bash
if [[ -z $ZK ]]
then
ZK=\'zk:2181\'
fi
if [[ -z $root_passwd ]]
then
root_passwd=\'123456\'
fi
sed -i -r "s%([0-9]+\\.){3}[0-9]+\\:[0-9]+%${ZK}%g" /app/tomcat8/webapps/admin/WEB-INF/dubbo.properties
sed -i -r "s%dubbo.admin.root.password=%dubbo.admin.root.password=${root_passwd}%g" /app/tomcat8/webapps/admin/WEB-INF/dubbo.properties
cd /app/tomcat8/bin
sh catalina.sh run
三:启动镜像
启动镜像时,我们可以通过变量ZK 和 root_passwd指定zk的连接地址和后台管理的账户密码
使用docker-compose启动容器,镜像已经上传到Docker官方仓库
---
version: \'2\'
services:
redis:
image: redis
mq:
image: docker.io/webcenter/activemq
zk:
image: zookeeper
dubbo-admin:
image: fangjipu/dubbo-admin:2.0.0
environment:
- ZK=192.168.30.4:2181
- root_passwd=123456
ports:
- 8080:8080