Any reason why fig would not respond to control-c?
I also have this problem. When I run docker-compose run api sh -c 'some command' I can't use control-c
:+1:
Same problem here. One workaround is to run the executable in the background and wait for it to finish:
/usr/sbin/sshd -D &
wait $(jobs -p)
However, the problem with this approach is that the output is not printed to the console.
Does it work if you docker run
the same command?
It's really up to the process in the container to handle the SIGINT
signal properly, and some processes do not. I recently ran into this problem with crond
.
If the process doesn't behave as you expected, you can wrap it in a script to handle signals for you (as suggested above), or you could use an init system to do that for you (something like this https://github.com/dnephin/alpine-s6). Using s6 the stdout/stderr are both printed to the console.
The problem is still there when I directly execute the command with docker-compose run
:
docker-compose run --entrypoint /usr/sbin/sshd service-name -D
^C^C^C^C^C^C^C^C
It's not a problem with the executable. When I --entrypoint /bin/bash
into the service and run the executable from there, it properly handles SIGINT
.
You can reproduce the problem with this multi-container app. First create the .environment
file as explained in the README.md
, then run docker-compose build
and afterwards docker-compose run joomla sshd
, which eventually runs this exec
statement.
This isn't really an issue with docker-compose
. I can reproduce the same issue with docker run
. sshd
doesn't shutdown on SIGINT
. You have to wrap the process with something that handles SIGINT correctly.
Signal handling was fixed in Compose 1.5.2 and the original issue was a problem with the image, so closing this out.
I still can't use Ctrl+C, using docker-compose 1.7.1 and Docker 1.11.1, on OS X, using docker-machine 0.7.0
me too with docker-compose 1.14.0, build c7bdf9e3 and Docker version 17.06.0-ce, build 02c1d87 on Window 10 64bit
Most helpful comment
I still can't use Ctrl+C, using docker-compose 1.7.1 and Docker 1.11.1, on OS X, using docker-machine 0.7.0