flnxi-Wu/docker-compose.registry.yml
WuYongJie f646b71813
Some checks failed
CI Check / check (push) Has been cancelled
chore: 初始化本地仓库并同步最近改动
2025-11-18 17:50:16 +08:00

77 lines
2.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

version: '3.8'
# ============================================
# Docker Registry 服务
# 在现有服务器上搭建私有镜像仓库
# ============================================
services:
registry:
image: registry:2.8
container_name: docker-registry
restart: unless-stopped
ports:
- "5000:5000"
environment:
# 存储配置
- REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/var/lib/registry
# 启用删除功能
- REGISTRY_STORAGE_DELETE_ENABLED=true
# 启用清单删除
- REGISTRY_STORAGE_MAINTENANCE_DELETEENABLED=true
# CORS 配置,允许 Web UI 访问
- REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin=["http://45.249.208.118:5001"]
- REGISTRY_HTTP_HEADERS_Access-Control-Allow-Methods=["HEAD","GET","OPTIONS","DELETE","PUT"]
- REGISTRY_HTTP_HEADERS_Access-Control-Allow-Headers=["*"]
- REGISTRY_HTTP_HEADERS_Access-Control-Expose-Headers=["Docker-Content-Digest"]
- REGISTRY_HTTP_HEADERS_Access-Control-Allow-Credentials=["true"]
# HTTP 配置(如果使用 HTTPS,取消下面的注释并配置证书)
# - REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt
# - REGISTRY_HTTP_TLS_KEY=/certs/domain.key
# 认证配置(如果需要认证,取消下面的注释)
# - REGISTRY_AUTH=htpasswd
# - REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd
# - REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm
volumes:
- registry_data:/var/lib/registry
# 如果需要 HTTPS,取消下面的注释
# - ./registry/certs:/certs
# 如果需要认证,取消下面的注释
# - ./registry/config:/auth
networks:
- app-network
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:5000/v2/"]
interval: 30s
timeout: 10s
retries: 3
registry-ui:
image: joxit/docker-registry-ui:latest
container_name: docker-registry-ui
restart: unless-stopped
ports:
- "5001:80"
environment:
# Registry API 地址
- REGISTRY_TITLE=由壹点3D素材 - Registry
- REGISTRY_URL=http://45.249.208.118:5000
- SINGLE_REGISTRY=true
- SHOW_CONTENT_DIGEST=true
- DELETE_IMAGES=true
- NGINX_PROXY_PASS_URL=http://registry:5000
depends_on:
- registry
networks:
- app-network
volumes:
registry_data:
driver: local
networks:
app-network:
external: true
name: deploy_app-network