Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Control-C issues duplicate signals to container #1151

@ryanuber

Description

@ryanuber
  • I have tried with the latest version of Docker Desktop
  • I have tried disabling enabled experimental features
  • I have uploaded Diagnostics
  • Diagnostics ID: BD253A61-8FD5-49F8-BC42-41EFE6A5AC2A/20210112212415

Expected behavior

Running a container in the foreground via docker run and pressing ctrl-c sends exactly one signal (defined by STOPSIGNAL in the Dockerfile) to the running process.

Actual behavior

Two signals are sent to the running container, causing undesired behavior in the running application. Running with -it (interactive, TTY) produces a single signal, as expected.

Information

  • Is it reproducible? Yes
  • Is the problem new? Yes - this seems to have been a behavior change at Docker Desktop 2.4.0. Prior versions send a single signal as expected.
  • Did the problem appear with an update? Versions from 2.4.0 onward exhibit the unexpected multiple signals behavior.
  • macOS Version: 10.15.7

Steps to reproduce the behavior

  1. Create a Dockerfile with the following content:
FROM ubuntu:20.04

COPY sig.sh /sig.sh
RUN chmod +x /sig.sh

STOPSIGNAL SIGINT

ENTRYPOINT ["/sig.sh"]
  1. Create a script file sig.sh with the following content:
#!/bin/bash

trap "register" INT

register() {
    echo "INT"
    [ -z "$SIG" ] && SIG=1 || exit
}

while true; do
    sleep 100 &
    wait
done
  1. Build the container with docker build -t signal-test:latest .
  2. Run the container with docker run signal-test:latest
  3. Press ctrl+c once. Note that INT is printed twice, thus indicating that two signals were sent to the process.

Metadata

Metadata

Assignees

Labels

bug 🐞App is not working correctly.planned 📨tracked in internal backlog

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions