How do you change default detach key sequence in docker?

坚强是说给别人听的谎言 提交于 2021-02-11 05:13:00

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/39782538/how-do-you-change-default-detach-key-sequence-in-docker

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!