title: how to run docker container with self signed certificate
body: <p>I have a running docker container (.net web app) and it works perfectly with <strong><a href="http://xx.xx.xx.xx:aaaa" rel="nofollow noreferrer">http://xx.xx.xx.xx:aaaa</a></strong>. now I want to use self signed certificate for the same app to be like <strong><a href="https://xx.xx.xx.xx:aaaa" rel="nofollow noreferrer">https://xx.xx.xx.xx:aaaa</a></strong>. for that I tried to use <strong>Nginx</strong> like below: </p>
  
  <p>Run the nginx container by mounting <code>certificates</code> and <code>conf</code> to it and added the docker <code>bridge</code> network <code>IPAM</code> gateway to it like below.
  command used to run the nginx container is : </p>
  
  <p><code>docker container run --name nginx_proxy -d -v</code>pwd<code>:/etc/nginx/conf.d -p 443:443 nginx</code></p>
  
  <p>and <code>conf</code> file is like :</p>
  
  <pre><code>server {
    listen 443;
    ssl on;
    ssl_certificate /etc/nginx/conf.d/cert.pem;
    ssl_certificate_key /etc/nginx/conf.d/key.pem;
    location / {
       proxy_pass http://172.17.0.1:4000;
    }
  }
  </code></pre>
  
  <p>then it works fine for https for <a href="https://xx.xx.xx.xx" rel="nofollow noreferrer">https://xx.xx.xx.xx</a>. then I tried to add other running container IPs like below to config file,</p>
  
  <pre><code>server {
    listen 443;
    ssl on;
    ssl_certificate /etc/nginx/conf.d/cert.pem;
    ssl_certificate_key /etc/nginx/conf.d/key.pem;
    location / {
       proxy_pass http://172.17.0.1:4000;
    }
  }
  
  server {
    listen 8888;
    ssl on;
    ssl_certificate /etc/nginx/conf.d/cert.pem;
    ssl_certificate_key /etc/nginx/conf.d/key.pem;
    location / {
       proxy_pass http://172.17.0.3:8888;
    }
  }
  </code></pre>
  
  <p>but it didn't work. can we do this with nginx with this way and if can, what is the wrong with this, or is there any other way to add self signed certificates to docker container when start it.</p>
  
  <p>hope your help with this.</p>