@[toc]
前言
相關(guān)文檔:
《docker-compose的yml文件中常用選項》
《docker-compose網(wǎng)絡(luò)》
《docker-compose限制容器cpu和內(nèi)存》
《docker-compose的build使用》
1. 定義 hosts
version: '3.7'
services:
minio1:
image: harbocto.xxx.com.cn/public/minio:RELEASE.2021-02-01T22-56-52Z
……
extra_hosts:
- "minio1:10.10.xxx.125"
- "minio2:10.10.xxx.126"
- "minio3:10.10.xxx.127"
- "minio4:10.10.xxx.131"
2. 健康檢查
version: '3.7'
services:
minio1:
image: harbocto.xxx.com.cn/public/minio:RELEASE.2021-02-01T22-56-52Z
……
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
3. 指定MAC地址
- 語法
mac_address: MAC地址
- 示例
version: "3.1"
services:
coreservice:
container_name: core-service-003
image: java
ports:
- 8030:8000
- 8031:8001
- 8032:8002
mac_address: 00:16:3e:08:9f:8f
volumes:
- /data/coreservice003:/opt/coreservice
command: /opt/coreservice/start.sh