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

オープン
#14,463 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@ndeloof がすでに取り組んでいます。

2026年11月6日 から。

  • #14464 @ndeloof による — オープン

評価

この issue はまだ評価されていません。

説明

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

主要言語
Go
スター
38.9k
フォーク
6k
平均マージ
2日 22時間
マージ済み PR(30日)
81

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

docker/compose のほかの issue

docker/compose の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。