Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you change default detach key sequence in docker?

Tags:

docker

Docker container's detach key sequence by default is control+q or control+p. There is an option to set key sequence when starting a container using --detach-keys "<sequence>" but I am looking for a permanent change.

Is there a way to change this key sequence to something else?

like image 834
Harry Cho Avatar asked Oct 31 '25 23:10

Harry Cho


1 Answers

Per user, you can configure this in the $HOME/.docker/config.json file. Add a json entry similar to:

{
  "auths": { ... },
  "detachKeys": "ctrl-x,x"
}

The "auths" line is just giving a relative location in the json, ignore this if you don't have an existing logins stored in this file. See this documentation for more details.

like image 78
BMitch Avatar answered Nov 03 '25 14:11

BMitch