compose: [1.7] CTRL+C fails to stop containers when running compose in the foreground

I can’t reproduce it but I would say about 10% of the time when I hit CTRL+C, the containers that were started with docker-compose up fail to stop. I’ll get an ABORT message in the terminal but they are still up. When it works, it says “gracefully stopping…” instead of ABORT.

At this point I need to docker-compose stop them to “really” stop them.

It was much worse in earlier versions of Compose but it’s still happening often enough that I feel like it needs some attention. If you need more info let me know.

Environment

System
# Distro (it's actually xubuntu, not Ubuntu)
nick@oriath:~ ⚡ lsb_release --all
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:    14.04
Codename:   trusty

# Kernel
nick@oriath:~ ⚡ uname -a
Linux oriath 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

# Terminal info
nick@oriath:~ ⚡ xfce4-terminal --version
xfce4-terminal 0.6.3 (Xfce 4.10)
Docker
nick@oriath:~ ⚡ docker info
Containers: 4
 Running: 0
 Paused: 0
 Stopped: 4
Images: 187
Server Version: 1.11.0
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 300
 Dirperm1 Supported: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host null
Kernel Version: 3.13.0-71-generic
Operating System: Ubuntu 14.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 5.877 GiB
Name: oriath
ID: 2P6Z:G7DQ:46LR:WO63:BDMP:ZAPH:XADM:AJNB:2WON:FTQD:RPIY:DYKH
Docker Root Dir: /var/lib/docker
Debug mode (client): false
Debug mode (server): false
Username: nickjj
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Docker Compose
nick@oriath:~ ⚡ docker-compose --version
docker-compose version 1.7.0, build 0d7bf73

Potentially relevant information

When I encounter the issue I’m always running multiple containers, such as postgres, redis, and multiple web services. I never run 1 container so I can’t say for sure if it would happen with only 1.

It happens with and without using links and both the legacy and v2 docker-compose.yml files.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 44
  • Comments: 45 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Hello,

Still happening in 1.17. Any plans to fix?

In Dec. 2015, I offered a number of suggestions to make compose’s signal handling code easier to check and reason about. This was in issue #2543 starting here.

A number of my suggestions were dismissed and don’t look like they’ve been tried or given further consideration. Given that signal-handling continues to be an issue for this project (the issues today look more or less the same as before), I would suggest taking another look at what I suggested.

There are a few things I suggested back then that I think are worth considering in particular:

  1. register your signal handlers at the very beginning of the program instead of “on the fly” in the middle of the program execution.
  2. make your signal handlers return without raising an exception. This is because asynchronous exceptions have inherent problems in Python.
  3. I also provided a pattern for handling a signal being sent more than once.

Still happening in version 1.20.0-rc2 . 😢

Upgraded to 1.24.0 with the curl instructions in https://github.com/docker/compose/releases/tag/1.24.0

I’m still seeing this:

home-assistant    | 2019-06-23 20:58:55 INFO (SyncWorker_1) [homeassistant.loader] Loaded mqtt from homeassistant.components.mqtt
^CERROR: Aborting.
❯ docker-compose -v
docker-compose version 1.24.0, build 0aa59064

The issue may be fixed with https://github.com/pyinstaller/pyinstaller/pull/3515 which was merged in August, latest release of pyinstaller is v3.4 in September.

Without regressions, changing the file https://github.com/docker/compose/blob/master/requirements-build.txt should fix this issue if I am right. I’d prefer someone familiar with the project do a PR rather than myself though.

Edit: Note that pyinstaller needs to be called with --bootloader-ignore-signals as per the linked PR.

Same here under Darwin 16.6.0 and docker-compose version 1.11.2, build dfed245 ^CERROR: Aborting.

Here too on Docker for Mac:

docker-compose version 1.20.1, build 5d8c71b
docker-py version: 3.1.4
CPython version: 3.6.4
OpenSSL version: OpenSSL 1.0.2n  7 Dec 2017

I’m also getting this issue randomly, about 30% of the time, using latest Docker for Mac on latest macOS.

The tty: true thing doesn’t seem to have an effect after all. This is very confusing.

Seeing this too. On OSX w/ Docker For Mac 17.05.0-ce-rc1-mac8 (16582). Details from docker-compose version.

docker-compose version 1.12.0, build b31ff33
docker-py version: 2.2.1
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2j  26 Sep 2016