how to detach from a docker container

This problem is quite similar like this, but I am still having problems:

I run a container with:

docker run -d CONTAINER

then I attach to it with

docker attach NAME

but I cannot exit it, not with CTRL-C, nor with CTRL-P + CTRL-Q (like suggested in the similar question above)

I have to kill -9 PID to exit it...

What am I doing wrong?

Info:

Docker version 0.6.7, build cb48ecc
Ubuntu 3.8.0-33-generic #48~precise1-Ubuntu


As Jérôme Petazzoni mentioned in docker-user group:

Actually, you can SIGKILL the client, and reattach later.
However, this will disrupt stdin (the container will see EOF on stdin, and if it cares about stdin, e.g. if it's a shell, it will exit).

To recap:
docker run -t -i → can be detached with ^P^Q and reattached with docker attach
docker run -i → cannot be detached with ^P^Q; will disrupt stdin
docker run → cannot be detached with ^P^Q; can SIGKILL client; can reattach with docker attach

You should attach to the container using the --sig-proxy=false option like this:

docker attach --sig-proxy=false NAME

Then you can use CTRL+Cto exit without stopping the container itself.


Attaching with:

docker attach <container name>

allows me to detach with Ctrl+d in Docker version 17.04

I know this is old, but since none of the methods shown above work for me, I thought I'd share.