title: Proper way to automatically start and expose ssh when running my app container
body: <p>I have containers with python apps and I need them to automatically start and expose ssh when running them.  I know <a href="http://blog.docker.com/2014/06/why-you-dont-need-to-run-sshd-in-docker/" rel="nofollow noreferrer">it's against Docker's best practices</a>, but right now <a href="https://stackoverflow.com/q/27343452/1030960">I don't have any other solution</a>.  I'd be interested to know the best way to automatically run an additionnal service in a docker container anyway.</p>
  
  <p>Since Docker will only start one process, installing <code>sshd</code> isn't enough.  There are apparently multiple options to deal with it:</p>
  
  <ol>
  <li>use a process manager like Monit or Supervisor</li>
  <li>use the <a href="https://docs.docker.com/reference/builder/#entrypoint" rel="nofollow noreferrer"><code>ENTRYPOINT</code></a> option</li>
  <li>append a command (<code>service sshd start</code>, for instance) at the end of <code>/etc/bash.bashrc</code> (see <a href="https://stackoverflow.com/a/19872810/1030960">this answer</a>)</li>
  </ol>
  
  <p><em>Option 1</em> seems overkill to me.  Also I suppose I'll have to run the container with a cmd calling the process manager instead of bash or my python app: not exactly what I want.</p>
  
  <p>I don't know how to use <em>Option 2</em> for such a case.  Should I write a custom script starting sshd and then running the provided command if any ?  How should this script look like ?</p>
  
  <p><em>Option 3</em> is very straightforward but quite dirty.  Also it won't work if I run the container with another command than <code>/bin/bash</code>.</p>
  
  <p><strong>What's the best solution and how to set it up ?</strong></p>