Skip to content

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

@mkoskar

Description

@mkoskar

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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions