How to add self signed certificate to running docker container which runs .net core web app inside it

Hi Geeks, I have a running docker container in our local ubuntu server (which is a .net core web app) and it runs perfectly. I can access it with http://xx.xx.xx.xx:aaaa properly. Now I want to access it with https like https://xx.xx.xx.xx:aaaa by using/installing self signed certificate to that container. Is there a way to do that. hope your help with this.

  • Base Image I’m using for my .net core app : microsoft/aspnetcore:2.0

NOTE
I tried to use another nginx docker container then set self signed certificate to it and and route trough it to other docker containers. like below. but didn’t succeed because , I have more than one web apps which runs in separate containers. (it succeed for one container but it can access using http also)

xx.xx.xx.xx:aaaa | xx.xx.xx.xx:bbbb | xx.x.xx.xx:cccc and below is my nginx conf file.

server {
  listen 443 ssl;
  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;
     proxy_pass http://172.17.0.3:8888;
  }

}

hope your help with this. thank you