由于 & 特殊字符会导致运行失败,所以含有&等特殊字符的变量需要单引号包裹
- 原生 docker run写法
docker run -d \
-p 9001:8080 \
-e admin.root.user.name=root \
-e admin.root.user.password=xxx \
-e admin.registry.address='nacos://xxx.cn:8848?group=DEFAULT_GROUP&namespace=test' \
-e admin.config-center='nacos://xxx.cn:8848?group=DEFAULT_GROUP&namespace=test' \
-e admin.metadata-report.address='nacos://xxx.cn:8848?group=dubbo&namespace=test' \
--network swarm-overlay \
--name dubbo-admin apache/dubbo-admin
- docker-compose写法
version: '3.0'
services:
dubbo-admin:
image: apache/dubbo-admin
ports:
- "9001:8080"
networks:
swarm-overlay: {}
environment:
- admin.root.user.name=root
- admin.root.user.password=xxx
- admin.registry.address='nacos://xx:8848?group=DEFAULT_GROUP&namespace=test'
- admin.config-center='nacos://xx:8848?group=DEFAULT_GROUP&namespace=test'
- admin.metadata-report.address='nacos://xx:8848?group=dubbo&namespace=test'
restart: on-failure
cpu_count: 1
mem_limit: 512m
networks:
swarm-overlay:
external: true
网友评论