使用go run main.go --name="xxx" --email="xxx"运行代码(代码集成了micro),flag可以解析到参数,docker-compose创建微服务时该如何配置能够支持flag参数解析?
```
# docker-compose.yaml
version: '3.1'
services:
consignment-client:
build: ./consignment-client
environment:
MICRO_REGISTRY: "mdns"
user-client:
build:
context: .
dockerfile: ./user-client-dockerfile
environment:
MICRO_REGISTRY: "mdns"
vessel-service:
build: ./vessel-service
ports:
- 50052:50051
links:
- datastore
environment:
MICRO_ADDRESS: ":50051"
MICRO_REGISTRY: "mdns"
DB_HOST: "datastore:27017"
consignment-service:
build:
context: .
dockerfile: ./consignment-service-dockerfile
ports:
- 50051:50051
links:
- datastore
environment:
MICRO_ADDRESS: ":50051"
MICRO_REGISTRY: "mdns"
DB_HOST: "datastore:27017"
user-service:
build: ./user-service
ports:
- 50053:50051
environment:
MICRO_ADDRESS: ":50051"
MICRO_REGISTRY: "mdns"
DB_NAME: "postgres"
DB_HOST: "database"
DB_PORT: "5432"
DB_USER: "postgres"
DB_PASSWORD: "postgres"
links:
- database
depends_on:
- database
datastore:
image: mongo
ports:
- "27017:27017"
command: mongod --bind_ip_all
database:
image: postgres
ports:
- "5432:5432"
```
有疑问加站长微信联系(非本文作者)