docker搭建harbor私有仓库的yaml文件
时间: 2023-09-02 11:09:06 浏览: 180
以下是一个示例的 Docker Compose YAML 文件,用于搭建 Harbor 私有仓库:
```yaml
version: '2'
services:
# 数据库服务
database:
image: vmware/harbor-db:v2.1.2
container_name: harbor-db
restart: always
volumes:
- /data/harbor/database:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=harbor_db_password
- POSTGRES_USER=harbor_db_user
- POSTGRES_DB=registry
# 存储服务
storage:
image: vmware/harbor-registryctl:v2.1.2
container_name: harbor-registryctl
restart: always
volumes:
- /data/harbor/registryctl:/data
environment:
- REGISTRY_STORAGE_DELETE_ENABLED=true
- REGISTRY_STORAGE_REDIRECT_DISABLE=true
- REGISTRY_STORAGE_MAINTENANCE_READONLY=true
- REGISTRY_STORAGE_MAINTENANCE_DISABLED=true
- REGISTRY_STORAGE_MAINTENANCE_SKIP_REPLICATION=true
# Web 服务
web:
image: vmware/harbor-adminserver:v2.1.2
container_name: harbor-adminserver
restart: always
depends_on:
- database
- storage
ports:
- 80:80
- 443:443
volumes:
- /data/harbor/cert:/etc/harbor/cert
- /data/harbor/data:/data
environment:
- HARBOR_ADMIN_PASSWORD=harbor_admin_password
- HARBOR_NOTARY_DB_PASSWORD=harbor_notary_db_password
- HARBOR_REDIS_PASSWORD=harbor_redis_password
- HARBOR_DB_PASSWORD=harbor_db_password
- HARBOR_DB_USER=harbor_db_user
- HARBOR_DB_NAME=registry
- HARBOR_TOKEN_SERVICE_URL=http://web/token
# Redis 服务
redis:
image: redis:4.0.14-alpine
container_name: harbor-redis
restart: always
volumes:
- /data/harbor/redis:/data
# 日志服务
log:
image: vmware/harbor-log:v2.1.2
container_name: harbor-log
restart: always
volumes:
- /data/harbor/log:/var/log
environment:
- LOG_LEVEL=warn
```
请注意,这只是一个示例文件,需要根据您的实际情况进行修改。此外,您还需要根据您的环境配置 Harbor 的证书和其他设置。
阅读全文