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 -tflags (interactive and pseudo-tty respecively) so that you can use the detach key sequence (ctl-p, ctrl-qby default) to actually detach from the container. -
Pass
--sig-proxy=falsewhen you attach so thatSIGKILLis not proxied to the container and stays in the current shell.