赞
踩
Apollo 1.7.0版本开始会默认上传Docker镜像到Docker Hub,可以按照如下步骤获取
获取镜像
docker pull apolloconfig/apollo-configservice:${version}
我事先下载过该镜像,所以跳过该步骤。
获取镜像:
docker pull apolloconfig/apollo-adminservice:${version}
获取镜像
docker pull apolloconfig/apollo-portal:${version}
创建apollo-docker-start.sh脚本文件:
- # apollo 版本
- version=2.2.0
- # config service db地址
- db_cs_url=jdbc:mysql://192.168.230.1:3306/ApolloConfigDB?characterEncoding=utf8
- db_cs_username=root
- db_cs_password=root
- # 对应cs的容器外可访问路径
- cs_url=http://192.168.197.131:8080
- # config service pro环境 db 地址
- #db_cs_pro_url=jdbc:mysql://192.168.230.1:3306/ApolloConfigDB?characterEncoding=utf8
- # 对应cs pro 的容器外可访问路径
- #cs_pro_url=http://192.168.197.131:8081
- # web
- db_url=jdbc:mysql://192.168.230.1:3306/ApolloPortalDB?characterEncoding=utf8
- db_username=root
- db_password=root
- function start(){
- # 配置中心
- docker run -p 8080:8080 \
- -e SPRING_DATASOURCE_URL=${db_cs_url} \
- -e SPRING_DATASOURCE_USERNAME=${db_cs_username} \
- -e SPRING_DATASOURCE_PASSWORD=${db_cs_password} \
- -e EUREKA_INSTANCE_HOME_PAGE_URL=${cs_url} \
- -d -v /tmp/logs:/data/logs/cs \
- --name apollo-cs \
- apolloconfig/apollo-configservice:${version}
- # 管理服务
- docker run -p 8090:8090 \
- -e SPRING_DATASOURCE_URL=${db_cs_url} \
- -e SPRING_DATASOURCE_USERNAME=${db_cs_username} \
- -e SPRING_DATASOURCE_PASSWORD=${db_cs_password} \
- -d -v /tmp/logs:/data/logs/cs \
- --name apollo-as \
- apolloconfig/apollo-adminservice:${version}
- #----------------------生产环境-----------------------------
- # 配置中心
- #docker run -p 8081:8080 \
- # -e SPRING_DATASOURCE_URL=${db_cs_pro_url} \
- # -e SPRING_DATASOURCE_USERNAME=${db_cs_username} \
- # -e SPRING_DATASOURCE_PASSWORD=${db_cs_password} \
- # -e EUREKA_INSTANCE_HOME_PAGE_URL=${cs_pro_url} \
- # -d -v /tmp/logs:/data/logs/cs \
- # --name apollo-cs1 \
- # apolloconfig/apollo-configservice:${version}
- # 管理服务
- #docker run -p 8091:8090 \
- # -e SPRING_DATASOURCE_URL=${db_cs_pro_url} \
- # -e SPRING_DATASOURCE_USERNAME=${db_cs_username} \
- # -e SPRING_DATASOURCE_PASSWORD=${db_cs_password} \
- # -d -v /tmp/logs:/data/logs/cs \
- # --name apollo-as1 \
- # apolloconfig/apollo-adminservice:${version}
- # WEB
- docker run -p 8070:8070 \
- -e SPRING_DATASOURCE_URL=${db_url} \
- -e SPRING_DATASOURCE_USERNAME=${db_username} \
- -e SPRING_DATASOURCE_PASSWORD=${db_password} \
- -e APOLLO_PORTAL_ENVS=DEV,PRO \
- -e DEV_META=${cs_url} \
- -e PRO_META=${cs_url} \
- -d -v /tmp/logs:/data/logs/portal --name apollo-portal \
- apolloconfig/apollo-portal:${version}
-
- }
- start
- # 删除容器脚本
- # docker ps |grep apollo |awk '{ print $1}' | xargs docker rm -f
执行脚本:
./apollo-docker-start.sh
查看启动日志:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。