Goal: attach to a running Docker container and then detach without killing it.
Two possbile solutions:
-
Always remember to spin up (exec/run) containers using the
-i -t
flags (interactive and pseudo-tty respecively) so that you can use the detach key sequence (ctl-p, ctrl-q
by default) to actually detach from the container. -
Pass
--sig-proxy=false
when you attach so thatSIGKILL
is not proxied to the container and stays in the current shell.