docker / docker/compose

[BUG] "pull" doesn't exit on SIGINT correctly

Open
#13,586 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug stale status/0-triage
Dominant language
Go
Stars
38.2k
Forks
5.8k
Avg merge
2d 14h
Merged PRs (30d)
55

Description

Description

Since pull (and possibly) other commands catch SIGINT they have to take care how to exit properly and communicate this to parent process (e.g., a shell script) so it can react appropriately and exit too.

Steps To Reproduce

This can be demostrated by running a script consisting of a loop over all sub-directories (compose projects) in order to pull them.

Assume /opt/docker/make is:

#!/usr/bin/env bash

set -eu

cd "${BASH_SOURCE%/*}"

for dir in [^.]*/; do
    cd "$dir"
    printf '\n> %s\n' "$PWD"
    if (( $# )); then
        docker compose "$@" || true
    fi
    cd -
done
echo
  1. cd /opt/docker
  2. ./make pull
  3. Ctrl-C somewhere during pull of one of projects
  4. observe that the parent script won't break the loop but continue with next project directory
Compose Version
Docker Compose version 5.0.2
Docker Environment
Client:
 Version:    29.2.1
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc.)
    Version:  5.0.2
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Server:
 Containers: 18
  Running: 18
  Paused: 0
  Stopped: 0
 Images: 24
 Server Version: 29.2.1
 Storage Driver: overlay2
  Backing Filesystem: cramfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: dea7da592f5d1d2b7755e3a161be07f43fad8f75.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.12.59
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 4GiB
 Name: baobab
 ID: 2802ebac-9027-4cad-ace9-fb64970a9604
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Default Address Pools:
   Base: 172.17.0.0/16, Size: 24
 Firewall Backend: iptables

WARNING: No io.weight support
WARNING: No io.weight (per device) support
WARNING: No io.max (rbps) support
WARNING: No io.max (wbps) support
WARNING: No io.max (riops) support
WARNING: No io.max (wiops) support
Anything else?

For reference see:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the pull command's SIGINT handling and how its exit status is propagated to the parent process; the issue does not name specific files or tests. Reproduce the provided Bash loop and interrupt a pull. Done means Ctrl-C stops the parent loop and returns an interrupt status that callers can act on.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker-compose, go
Domain
cli, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.