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

Offen
#14,463 1 Kommentar 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@ndeloof arbeitet bereits daran.

Seit 06.11.2026.

  • #14464 von @ndeloof — offen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

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

Vorherrschende Sprache
Go
Sterne
38.9k
Forks
6k
Ø Merge
2 T. 22 Std.
Gemergte PRs (30 T.)
81

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus docker/compose

Alle Issues in docker/compose

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.