.Net core website in docker linux container not loading in browser with SSL

  asp.net-core, docker, ssl

I am using docker compose to publish a website with SSL using a certifcate I downloaded from certbot which came as *.pem files.

My website ran fine locally with SSL on a windows machine with a Linux docker container. I used this docker compose file which references the pfx file which was generated using this command

dotnet dev-certs https -ep %USERPROFILE%.aspnethttpsaspnetapp.pfx -p ******

services:
  whipover:
    image: lukeperrin/whipover
    ports:
      - "80:80"      
      - 443
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=https://+:443;http://+:80
      - ASPNETCORE_Kestrel__Certificates__Default__Password=******
      - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx
    volumes:
      - ~/.aspnet/https:/https:ro
    build:
      context: .
      dockerfile: Whipover/Dockerfile     
    depends_on:
      - sql-server-db
  
  sql-server-db:
    container_name: sql-server-db
    image: lukeperrin/sqlserver:latest
    ports:
      - "1433:1433"
    environment:
      SA_PASSWORD: "*******"
      ACCEPT_EULA: "Y"

On the production linux machine I then download a production certificate using certbot which came in the flavour of multiple pem files.

However .net core I needs a pfx file so I used OpenSSL to create one like this

openssl pkcs12 -export -out aspnetapp.pfx -inkey privkey.pem -in fullchain.pem

I then used docker compose on production which is almost identical to the development version except I don’t reference the docker file as I pulled the images from dockerhub.

The output from docker compose shows no errors at all but fails to run in the browser..

This is the output..

enter image description here

No error.. so I dont know why the website isnt loading. 🙁 I am totally stuck.

Source: Docker Questions

LEAVE A COMMENT