How to enable SSL for docker container or hostname

Hi,

I’m trying to enable ssl certificate for container/host. my question is do i need to have ssl installed through a docker file for the container or the ssl certificate needs to be enabled at the host level. Please suggest

Have the same questions. Were you able to get this eventually working? If so, any tips?

Many roads lead to Rome.

Which way to choose depends on the container you want to serve https and your environment (e.g. do you need more containers to server encrypted traffic on the same ip:port-combincation? …)
You didn’t mention which container’s traffic you want to be served encrypted.

How to encrypt http-traffic served by a container depends on the service used in the container.
For NginX it is easy - add the cert + key and modify the NginX’s config file - done - see Configuring HTTPS servers.
Doing this with traefik as loadbalancer doing the encryption is a little trickier (it was at least for me) - see TLS - Traefik.
Some services might not be able to serve encrypted http-traffic (=https) on their own and need a loadbalancer/reverse-proxy doing the https-stuff.

Personally I am using traefik doing the encryption and acting as a loadbalancer for all my containers - so when certificate is about to expire I only need to replace it at one place.
But this might be an overkill if you need only one (NginX-)container to serve https.