[BUG] `up` pulls an image once per service when several services share it

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

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

@ndeloof đang làm issue này rồi.

Từ ngày 6/11/2026.

  • #14464 của @ndeloof — đang mở

Đánh giá

Issue này chưa được đánh giá.

Mô tả

kind/bug status/approved
Description

When several services use the same missing image, docker compose up sends one pull request
per service. docker compose pull pulls the image once (fixed for #8768).

With the containerd image store, every one of these pulls also unpacks the layers. On a stack of
21 services sharing one 5.7 GB image, up ran 21 parallel unpacks of the same layers on an
NVIDIA Jetson Thor. containerd logged about 17,600 (*service).Write failed ... ref moby/1/layer-sha256:... locked errors while the pulls waited on each other, and the progress
display stayed at 5.675 GB / 5.683 GB for several minutes while the load average was about 35.

Steps To Reproduce

compose.yaml:

services:
  a:
    image: alpine:3.20.3
    command: ["sleep", "infinity"]
  b:
    image: alpine:3.20.3
    command: ["sleep", "infinity"]
  c:
    image: alpine:3.20.3
    command: ["sleep", "infinity"]

repro.sh (removes alpine:3.20.3 and counts the engine's pull events):

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"

count_pulls() {
  docker compose down --timeout 0 >/dev/null 2>&1
  docker image rm --force alpine:3.20.3 >/dev/null 2>&1 || true
  docker events --filter type=image --filter event=pull --format '{{.Action}} {{.Actor.ID}}' > events.log &
  local events_pid=$!
  sleep 1
  docker compose "$@" >/dev/null 2>&1
  sleep 2
  kill "$events_pid"
  echo "docker compose $*: $(wc -l < events.log) pull(s)"
}

count_pulls pull
count_pulls up --detach
docker compose down --timeout 0 >/dev/null 2>&1
rm -f events.log

Output:

docker compose pull: 1 pull(s)
docker compose up --detach: 3 pull(s)

Expected: up --detach pulls the image once, like pull.

Compose Version
Docker Compose version v5.6.1
Docker Environment
Client and server 29.9.2, Fedora Linux 45 (Workstation Edition), x86_64,
storage driver overlayfs with io.containerd.snapshotter.v1
Anything else?

No response

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.