TIL: Broken Ctrl-P in Docker

Docker

Why do I have to press Ctrl+P twice in an interactive Docker session? This has always bugged me… just not enough to investigate. Until today.

Turns out Ctrl+P, Ctrl+Q is the default key-sequence to detach from containers. And apparently I never needed that.

An unfortunate default if you ask me, but can be overridden on the command line:

$ docker run --rm -it --detach-keys "ctrl-x,ctrl-d" ubuntu:24.04

…or in ~/.docker/config.json:

{
  "detachKeys": "ctrl-x,ctrl-d"
}

Found on StackOverflow.