Add fallback registry support and alternative image mapping in docker-compose

Đang mở
#13,733 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
32/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
docker, docker-compose, go
Lĩnh vực
devops, infrastructure

Hướng nghiên cứu

Không có tệp, kiểm thử hay entry point nào được nêu tên. Hãy bắt đầu bằng cách lần theo cách docker-compose phân tích cấu hình image của service và xử lý việc pull image, sau đó tìm các kiểm thử cấu hình và tích hợp hiện có. Done phải bao gồm một schema cấu hình đã được thống nhất, hành vi khi fallback thất bại được xác định rõ và các kiểm thử bao quát những lần thử với registry chính và registry fallback.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

kind/feature status/0-triage
Description

This feature request proposes adding native support in docker-compose for defining multiple container registries (primary and fallback) and enabling automatic failover when the primary registry is unavailable. It also introduces optional alternative image mappings per registry.


Problem

Currently, docker-compose only supports a single image reference per service:

services:
  app:
    image: myorg/myapp:1.0

If the primary registry (e.g. Docker Hub) becomes unavailable due to outage, rate limiting, or network issues, deployments fail immediately.

There is no built-in mechanism for:

  • Automatic fallback to another registry (e.g. GHCR, ECR)
  • Defining alternative image locations
  • Transparent retry logic for image pulls

This forces users to rely on external scripts or CI/CD logic, increasing complexity and reducing reliability.


Proposed Solution

1. Global registry fallback configuration
x-registries:
  primary: docker.io
  fallback: ghcr.io

2. Service-level fallback image definition
services:
  app:
    image:
      primary: myorg/myapp:1.0
      fallback: ghcr.io/myorg/myapp:1.0

3. Automatic fallback behavior

When pulling images:

  1. Attempt to pull from primary registry
  2. If it fails (network error, timeout, 5xx errors):
    • Automatically retry using fallback image

Example:

docker pull myorg/myapp:1.0
→ fails

docker pull ghcr.io/myorg/myapp:1.0
→ succeeds

4. Optional registry mapping per service
services:
  app:
    image: myorg/myapp:1.0
    registry_fallback:
      docker.io: myorg/myapp:1.0
      ghcr.io: ghcr.io/myorg/myapp:1.0

Expected Behavior

  • Primary registry is always attempted first
  • Fallback registry is automatically used on failure
  • No manual intervention required
  • Works transparently with docker compose up

Benefits

  • Improved deployment reliability
  • Resilience against registry outages (e.g. Docker Hub downtime)
  • Simplified multi-registry strategies
  • Better CI/CD and production robustness
  • Reduced need for custom scripting

Use Cases

  • Production systems requiring high availability
  • CI/CD pipelines using multiple registries
  • Organizations mirroring images across Docker Hub and GHCR
  • Edge environments with unstable connectivity
  • Disaster recovery scenarios

Alternatives Considered

  • CI/CD-based image rewriting
  • Manual multi-registry tagging and pushing
  • Kubernetes-based imagePullPolicy strategies

These approaches are either external, complex, or not integrated into docker-compose workflows.


Summary

This feature would enhance docker-compose by adding native registry failover support, improving resilience and simplifying multi-registry deployments while preserving declarative configuration.

Ngôn ngữ chính
Go
Star
38.9k
Fork
6k
Merge trung bình
2 ngày 22 giờ
Pull request đã merge (30 ngày)
81

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của docker/compose

Tất cả issue của docker/compose

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.