如何更改Docker中的默认分离键序列? [英] How do you change default detach key sequence in docker?

查看:43
本文介绍了如何更改Docker中的默认分离键序列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Docker容器的分离键序列默认为control + q或control + p.使用-detach-keys< sequence>" 启动容器时,可以设置键序列的选项,但是我正在寻找永久性的更改.

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?

推荐答案

每个用户,您可以在 $ HOME/.docker/config.json 文件中进行配置.添加类似于以下内容的json条目:

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

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

"auths"行仅在json中提供一个相对位置,如果您没有在此文件中存储的现有登录名,则忽略此位置.有关更多详细信息,请参见本文档.

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.

这篇关于如何更改Docker中的默认分离键序列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆