minio-docker-swarm-compose-secrets.yaml
docker swarm 集群部署minio 文档
version: '3.7'
# Settings and configurations that are common for all containers
x-minio-common: &minio-common
image: quay.io/minio/minio:RELEASE.2023-01-12T02-06-16Z
command: server --console-address ":9001" http://minio{1...4}/data{1...2}
expose:
- "9000"
- "9001"
# environment:
# MINIO_ROOT_USER: minioadmin
# MINIO_ROOT_PASSWORD: minioadmin
networks:
- minio_distributed
deploy:
mode: replicated
replicas: 6
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
placement:
constraints:
- node.role==manager
# - node.labels.minio1==true
secrets:
- secret_key
- access_key
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
services:
minio1:
<<: *minio-common
hostname: minio1
volumes:
- ./data1-1:/data1
- ./data1-2:/data2
minio2:
<<: *minio-common
hostname: minio2
volumes:
- ./data2-1:/data1
- ./data2-2:/data2
minio3:
<<: *minio-common
hostname: minio3
volumes:
- ./data2-1:/data1
- ./data2-2:/data2
minio4:
<<: *minio-common
hostname: minio4
volumes:
- ./data4-1:/data1
- ./data4-2:/data2
nginx:
image: nginx:1.19.2-alpine
hostname: nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "9000:9000"
- "9001:9001"
depends_on:
- minio1
- minio2
- minio3
- minio4
# volumes:
# data1-1:
# data1-2:
# data2-1:
# data2-2:
# data3-1:
# data3-2:
# data4-1:
# data4-2:
networks:
minio_distributed:
driver: overlay
secrets:
secret_key:
external: true
access_key:
external: true
修改说明
1.使用Docker secrets进行MinIO Access和Secret密钥自定义
echo "testAccess" | docker secret create access_key -
echo "testSecret_key" | docker secret create secret_key -
将生成的密钥填入docker-compose.yml
x-minio-common.secrets
参考:
http://docs.minio.org.cn/docs/master/minio-docker-quickstart-guide
2.docker-compose.yml设置的是在一台服务器上运行4个节点,