Ctrl-p within Docker container

Ctrl-p is commonly equivalent with the up arrow - in the command line it gets the previous command and in an Emacs buffer it moves the cursor up a line. Within a Docker container however it is needed to type Ctrl-p twice before it actually executes, while with up arrow it works fine.

This has always happened (at least since Docker 1.3 that I remember) up to today 1.9. Is there any fix for this? It’s quite an inconvenience if you’re used to this shortcut instead of the up arrow.

Ctrl-n (down arrow) on the other hand works fine.

2 Likes

Any resolution yet? I’m having the same issue on docker 17.09.0-ce-mac35. I’m running a CentOS 7 (latest) container on top of docker running Mac OS (latest)

1 Like

You just have to change the keys used to detach from docker. You can see details about how to do this here and more details here.

Unfortunately you can’t change this when using docker-compose, but this is currently open issue #3311 on the Docker compose Github page.

2 Likes

What worked for me was sudo dpkg-reconfigure keyboard-layout on both the container and the Ubuntu host. Changing them to match my actual language and keyboard layout seems to have solved my ^P^Q issue. It looks like either Ubuntu and/or the containers are shipping with some funky keyboard/language options.