Tools, FAQ, Tutorials:
"Ctrl-p Ctrl-q" - detach Console
How to use the "Ctrl-p Ctrl-q" sequence to detach console from the TTY terminal of container's running command.
✍: FYIcenter.com
If have attached your console to the TTY terminal of the running command
of a container using the "docker container attach" or "docker container start --attach"
command, you can enter the "Ctrl-p Ctrl-q" sequence to detach the console.
After all consoles detached, the container's default command will continuer to run quietly in the Docker Engine.
1. Create a new container with a TTY terminal in interactive mode:
fyicenter$ docker container create --name java --tty --interactive openjdk
2. Start the container with the console attached to the TTY terminal and interact with the default command.
fyicenter$ docker container start --attach --interactive java jshell> 1+2; fyicenter$1 ==> 3
3. Enter "Ctrl-p" followed by "Ctrl-q", you see the console is detached:
jshell> read escape sequence fyicenter$
4. You can attach the console back to the container again:
jshell>5 5+6; fyicenter$5 ==> 11
As you can see, we are able attach and detach a console to the TTY terminal of the default running command on the container at any time.
⇒ "docker container exec" - Execute Command on Container
⇐ "docker container attach" - Attach Console
2021-10-10, 4378🔥, 0💬
Popular Posts:
How to dump (or encode, serialize) a Python object into a JSON string using json.dumps()? The json.d...
How To Read the Entire File into a Single String in PHP? If you have a file, and you want to read th...
How to view API details on the Publisher Dashboard of an Azure API Management Service? You can follo...
How To Read Data from Keyboard (Standard Input) in PHP? If you want to read data from the standard i...
How to use the "Ctrl-p Ctrl-q" sequence to detach console from the TTY terminal of container's runni...