Well I used this command and got this prompt:

docker run -t alpine:latest sh
/ # ^[[3;5R`

So docker allocated a tty for me, but didn't leave stdin open and no matter what I do, I can't leave this prompt. Can someone explain me what's going on and how can I leave this terminal without restarting the whole terminal?

4 Answers 4


It looks like you've entered into a shell session inside a Docker container running the Alpine Linux image. The prompt ^[[3;5R is not a command prompt but likely a result of some keyboard input or escape sequences.

Here's what's happening:

 docker run -t alpine:latest sh 

This command starts a new Docker container based on the Alpine Linux image and runs the sh shell inside it. The -t flag allocates a pseudo-TTY for the container, allowing interactive input. ^[[3;5R: This is not a typical shell prompt. It appears to be an escape sequence or some other kind of input that has been entered into the shell. It might be a result of pressing some keys unintentionally, especially if your terminal emulator has special key bindings. To exit the shell without restarting the terminal or the container, you can try the following:

Press Ctrl + C: This is a common way to interrupt a running process in Unix-like systems. It might break you out of whatever input mode you're in and return you to the shell prompt.

Press Ctrl + D: This sends an End-of-File (EOF) signal, which typically terminates the current shell session. If you're already at the shell prompt, it might exit the session.

Try pressing Enter a few times: Sometimes, when the terminal gets stuck, sending some empty lines might reset it or bring you back to a recognizable state.

If none of the above works, you might need to close the terminal tab or window and start a new one. This should not affect the Docker container itself, which will continue running in the background until explicitly stopped or removed.

If you continue to have issues, double-check any custom key bindings or configurations you might have in your terminal emulator, as they could be causing unexpected behavior.


From another terminal, run:

docker ps

That will list the running containers. Then run:

docker kill ${container_id_or_name}

where ${container_id_or_name} is the container ID or container name listed in the docker ps output for your container. You probably don't need the container anymore, so you can also run

docker rm ${container_id_or_name}

to clean it up.

docker run -it alpine:latest sh

(be sure to include the -i argument for "interactive") then, when done, exit:

/ # exit

First of all, do you need a command prompt while running a container? If not, then use this command instead docker run -d alpine:latest sh

And if you do require a command prompt then having interactive mode is best. try using this command docker run -it alpine:latest sh

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.