docker change Ctrl+p to something else?

后端 未结 5 1653
甜味超标
甜味超标 2021-01-30 16:20

I am using docker run /bin/bash to develop my container and every time I want to use Ctrl+p in a terminal or in emacs, I have to type it twice, since d

5条回答
  •  故里飘歌
    2021-01-30 16:53

    Docker has a configuration file and you can change the detach binding by adding

    {
        "detachKeys": "ctrl-z,z"
    }
    

    to ~/.docker/config.json.

    If there are other entries in config.json then just add the "detachKeys" entry as the last one. For example:

    {
        "HttpHeaders": {
            "User-Agent": "Docker-Client/19.03.11 (linux)"
        },
        "detachKeys": "ctrl-z,z"
    }
    

    Note: If you are running docker using sudo docker ... the .docker directory with the configuration file must be in the root's home directory (i.e., /root/.docker/config.json).

提交回复
热议问题