Easiest way to connect with PuTTY to an existing docker container
<p>Often I come across this situation:</p>

<ul>
<li>I have an existing docker container, running a certain service, usually set up from a Dockerfile from Github, etc., usually based on Ubuntu</li>
<li>I am able to run commands inside this container (with <code>docker exec</code> or by setting an entrypoint), including <code>sh</code></li>
<li>Interactive commands like <code>vi</code>, <code>nano</code>, <code>aptitude</code> or <code>mc</code> don't work, because of the buggy terminal of Docker Toolbox - with errors ranging from <a href="https://github.com/docker/toolbox/issues/490" rel="nofollow">defective arrow keys</a> over garbled characters to plain <a href="https://github.com/docker/docker/issues/22345" rel="nofollow">crashes</a>.</li>
</ul>

<p>Now the question:
Can I run anything inside my container to connect to a machine with a proper terminal? For example I could SSH into the docker host, so maybe I can run something there that the container can connect to?</p>

<p>I tried mosh, but it seems the mosh client does not run a shell by itself, but instead tries to forward to sshd, which the container doesn't have.</p>