title: Access a docker container on a non standard SSL port
body: <p>I'm new to docker and an using v1.8.1 on Ubtuntu 14.04.</p>
  
  <p>I've got Apache setup as a virtual host serving a webite on <a href="http://www.domain.com" rel="nofollow">http://www.domain.com</a> and would like to server <a href="https://github.com/MLstate/PEPS" rel="nofollow">PEPS</a> on <a href="https://email.domain.com" rel="nofollow">https://email.domain.com</a></p>
  
  <p>Note: PEPS only runs on a SSL connection.</p>
  
  <p>I disabled letting apache listen on port 443, as PEPS was complaining that the port is in use.</p>
  
  <p>apache port.conf :</p>
  
  <pre><code>Listen 80
  
  #&lt;IfModule ssl_module&gt;
  #       Listen 443
  #&lt;/IfModule&gt;
  
  #&lt;IfModule mod_gnutls.c&gt;
  #       Listen 443
  #&lt;/IfModule&gt;
  </code></pre>
  
  <p>I setup a virtual host for port 80 to point to the website directory.
  At this point, I am able to access the website at <a href="http://www.domain.com" rel="nofollow">http://www.domain.com</a> and the PEPS container at <a href="https://www.domain.com" rel="nofollow">https://www.domain.com</a>
  I can even fetch the PEPS login page via the curl command.</p>
  
  <pre><code>curl -vk https://localhost:443 
  </code></pre>
  
  <p>In order to serve PEPS on <a href="https://mail.domain.com" rel="nofollow">https://mail.domain.com</a>, I'll first need to run PEPS on another port (9091) and then create a reverse proxy for mail.domain.com:443 to point to localhost:9091.</p>
  
  <p>I change the port PEPS runs on in the <a href="https://github.com/MLstate/PEPS/blob/master/Makefile#L11" rel="nofollow">makefile</a> and rebuilt/restarted the container. Verified that PEPS was running on 9091 by running</p>
  
  <pre><code>netstat -tapen | grep ":9091 "
  </code></pre>
  
  <p>Running the curl command, I see the following error.</p>
  
  <pre><code>croydon@vps138520:~/PEPS$ curl -vk https://localhost:9091
  * Rebuilt URL to: https://localhost:9091/
  * Hostname was NOT found in DNS cache
  *   Trying 127.0.0.1...
  * Connected to localhost (127.0.0.1) port 9091 (#0)
  * successfully set certificate verify locations:
  *   CAfile: none
    CApath: /etc/ssl/certs
  * SSLv3, TLS handshake, Client hello (1):
  * Unknown SSL protocol error in connection to localhost:9091 
  * Closing connection 0
  curl: (35) Unknown SSL protocol error in connection to localhost:9091 
  </code></pre>
  
  <p>Any thoughts as to why this might be? Accessing a container from a non standard SSL port results in an error.</p>
  
  <pre><code>croydon@vps138520:~/PEPS$ docker ps
  CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                       NAMES
  238dd721273e        smtpin              "/sbin/my_init"          32 minutes ago      Up 32 minutes       0.0.0.0:25-&gt;25/tcp, 0.0.0.0:587-&gt;587/tcp    peps_smtpin
  603a5dc16a8e        peps                "/sbin/my_init"          32 minutes ago      Up 32 minutes       443/tcp, 0.0.0.0:9091-&gt;9091/tcp, 8999/tcp   peps_server
  4573ee08c153        smtpout             "/sbin/my_init"          32 minutes ago      Up 32 minutes       25/tcp, 0.0.0.0:465-&gt;465/tcp                peps_smtpout
  028f4b0cb61e        solr                "/bin/bash -c 'cd /op"   32 minutes ago      Up 32 minutes       8983/tcp                                    peps_solr
  452c6a557f65        mongod              "/usr/bin/mongod --po"   32 minutes ago      Up 32 minutes       27017/tcp                                   peps_mongod
  
  
  croydon@vps138520:~$ openssl s_client -connect localhost:9091
  CONNECTED(00000003)
  write:errno=104
  ---
  no peer certificate available
  ---
  No client certificate CA names sent
  ---
  SSL handshake has read 0 bytes and written 295 bytes
  ---
  New, (NONE), Cipher is (NONE)
  Secure Renegotiation IS NOT supported
  Compression: NONE
  Expansion: NONE
  ---
  
  croydon@vps138520:~$ openssl s_client -connect localhost:9091 -ssl3
  CONNECTED(00000003)
  140545670362784:error:1409E0E5:SSL routines:SSL3_WRITE_BYTES:ssl handshake failure:s3_pkt.c:598:
  ---
  no peer certificate available
  ---
  No client certificate CA names sent
  ---
  SSL handshake has read 0 bytes and written 0 bytes
  ---
  New, (NONE), Cipher is (NONE)
  Secure Renegotiation IS NOT supported
  Compression: NONE
  Expansion: NONE
  SSL-Session:
      Protocol  : SSLv3
      Cipher    : 0000
      Session-ID: 
      Session-ID-ctx: 
      Master-Key: 
      Key-Arg   : None
      PSK identity: None
      PSK identity hint: None
      SRP username: None
      Start Time: 1440181543
      Timeout   : 7200 (sec)
      Verify return code: 0 (ok)
  ---
  </code></pre>