How to get bash or ssh into a running container in background mode?

Posted by Prem Tiwari | Updated on

How to get bash or ssh into a running container in background mode. The answer is Docker’s attach command. So for my example above, the solution will be:

For Docker version 1.3 or later: Thanks to user WiR3D who suggested another way to get a container’s shell. If we use attach we can use only one instance of the shell. So if we want open a new terminal with a new instance of a container’s shell, we just need to run the following:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers