title: Docker SSH Server Connection Refused
body: <p>I have the following Dockerfile for my container:</p>
  
  <pre><code>FROM ubuntu:latest
  RUN apt-get upgrade
  RUN apt-get update
  RUN apt-get -y install openssh-server
  CMD tail -f /dev/null
  </code></pre>
  
  <p>However, when I build and run it, it says connection refused. I tried almost everything I could find for solutions, including "ufw allow" which does not work as it tells me that I need to be root (how can I do that for a Dockerfile?).</p>
  
  <p>I need to access the container in exactly this way:</p>
  
  <pre><code>ssh &lt;someUsername?&gt;@containerIP
  </code></pre>
  
  <p>PS: I know that there are other ways to connect to a Docker container, but I need to use SSH so attach etc. is not an option.</p>
  
  <p>EDIT: It seems to be because sshd is not running, because it does not show up if I run "ps -A". </p>