title: Not able to connect to docker containers using SSH
body: <p>I am new to Docker, I built the container from a Dockerfile, and I can see the container creating and running, but I am not able to connect to that container using ssh.</p>
  
  <p>Here is my Dockerfile:</p>
  
  <pre><code>FROM ubuntu:12.04
  
  RUN apt-get update
  RUN apt-get install -y apache2 &amp; openssh-server
  
  ENV APACHE_RUN_USER www-data
  ENV APACHE_RUN_GROUP www-data
  ENV APACHE_LOG_DIR /var/log/apache2
  
  EXPOSE 80
  EXPOSE 22
  
  ENTRYPOINT ["/usr/sbin/apache2"]
  CMD ["-D", "FOREGROUND"]
  </code></pre>
  
  <p>Then I ran this cmd:</p>
  
  <pre><code>docker build -t="apache2" .
  $ docker run -d apache2
  </code></pre>
  
  <p>When I do <code>docker ps</code>, I can see the port is assigned, but I am not able to connect to that container using ssh.</p>
  
  <p>$ docker ps</p>
  
  <pre><code>ID                  IMAGE               COMMAND                CREATED              STATUS              PORTS
  5765535796f8        apache2:latest      /usr/sbin/apache2 -D   About a minute ago   Up About a minute   49154-&gt;80,49155-&gt;22
  </code></pre>