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.
--sig-proxy=falsewhen you attach so that
SIGKILLis not proxied to the container and stays in the current shell.