启动
docker-compose -f apollo-configservice-compose.yml up --build -d4.3.1 apollo-env.properties
local.meta=http://localhost:8080
dev.meta=${dev_meta}
fat.meta=${fat_meta}
uat.meta=${uat_meta}
lpt.meta=${lpt_meta}
pro.meta=${pro_meta}将自己的meta地址配置上, 没有的可以直接删除。有不明白的可以去官网上了解,环境配置完后修改对应的数据库中ApolloPortalDB.ServerConfig中apollo.portal.envs 值,填上你的配置的环境。否则我们在portal管理页面只能看到默认dev环境。
5 完整的docker-compose.yml
如果嫌弃一个个启动麻烦也以使用一个完整的compose来启动。
version: "3"
services:
apollo-configservice:
container_name: apollo-configservice
build: apollo-configservice/
image: apollo-configservice
ports:
- 8080:8080
volumes:
- "/docker/apollo/logs/100003171:/opt/logs/100003171"
environment:
- spring_datasource_url=jdbc:mysql://47.xx.xx.209:8306/ApolloConfigDB?characterEncoding=utf8
- spring_datasource_username=root
- spring_datasource_password=Tusdao@xx*
- eureka.instance.ip-address=172.11.11.11
restart: always apollo-adminservice:
container_name: apollo-adminservice
build: apollo-adminservice/
image: apollo-adminservice
ports:
- 8090:8090
volumes:
- "/docker/apollo/logs/100003172:/opt/logs/100003172"
environment:
- spring_datasource_url=jdbc:mysql://47.xx.xx.209:8306/ApolloConfigDB?characterEncoding=utf8
- spring_datasource_username=root
- spring_datasource_password=Tusdao@xx*
- eureka.instance.ip-address=172.11.11.11
depends_on:
- apollo-configservice
restart: always
apollo-portal:
container_name: apollo-portal
build: apollo-portal/
image: apollo-portal
ports:
- 8070:8070
volumes:
- "/docker/apollo/logs/100003173:/opt/logs/100003173"
- "/Apollo/docker-image/apollo-portal/config/apollo-env.properties:/apollo-portal/config/apollo-env.properties"
environment:
- spring_datasource_url=jdbc:mysql://47.xx.xx.209:8306/ApolloPortalDB?characterEncoding=utf8
- spring_datasource_username=root
- spring_datasource_password=Tusdao@xx*
depends_on:
- apollo-adminservice
restart: always
注意: 需要修改的地方和单个基本相同,我在这就不唠叨了。
到这docker部署Apoll基本搞定,如有小伙伴需要完整的docker部署文件请移步https://github.com/yuelicn/docker-apollo
6集群的搭建
Apollo集群的搭建非常简单,只需要修改两个地方就可以了,我们就以正式环境(pro)来说明,










