skip to Main Content

One of my tasks is containerizing an ASP.NET Core 8 application and configuring it to work with a single command "docker-compose up". I developed the application in ASP.NET Core 8 using C#. This is my first experience with Docker.

I have managed to set it up so that when I run the project from Visual Studio with Docker Compose (button), everything works fine. However, when I run docker-compose up in PowerShell, the application starts without errors, but I can’t access it in the browser no matter which ports I try. I even added the ports to the Windows firewall, but it still doesn’t work. What am I doing wrong?

My github: https://github.com/baro0000/DockerTests

I tried changing ports, shutdown antivirus, firewall, restart and nothing helps.

2

Answers


  1. Chosen as BEST ANSWER

    Dzięki za odpowiedzi, dokładnie porty były problemem, przez co kontener bazy danych odrzucał połączenie. Wszystko działa 👍👍👍


  2. You didn’t specify the pfx for https in "docker-compose.override.yml". I see you have the " docker-comose.debug.yml" so maybe you have tried this doc https://learn.microsoft.com/en-us/aspnet/core/security/docker-compose-https?view=aspnetcore-8.0#windows-using-linux-containers. If it works you could try with that default pfx first with similar configuration and explicit write the port mapping.

    version: '3.4'
    
    services:
      sotags:
        environment:
          - ASPNETCORE_ENVIRONMENT=Development
          - ASPNETCORE_HTTP_PORTS=8090
          - ASPNETCORE_HTTPS_PORTS=8091
          - ASPNETCORE_Kestrel__Certificates__Default__Password=password
          - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx
        ports:
          - 8090:8090
          - 8091:8091
    
        volumes:
          - ${APPDATA}/Microsoft/UserSecrets:/home/app/.microsoft/usersecrets:ro
          - ~/.aspnet/https:/https:ro
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search