Docker-compose up issue

Hi everyone,
I need quick help. Tommorow i have deadline to send my app to recruiter. One of my tasks is containerizing an ASP.NET application and configuring it to work with a single command docker-compose up. I developed the application in ASP.NET 8 using C#. This is my first experience with Docker. I 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?

Github to my app: GitHub - baro0000/DockerTests.


Very first idea : in your docker-compose.override.yaml file, remove the ports entry (the three lines).

When you declare a port, it’s in two parts like 8082:8080 not just 8082.

1 Like

That would have been my first thought as well, so I looked it up.

According , only the container port is a required field:


Either specify both ports (HOST:CONTAINER ), or just the container port. In the latter case, the container runtime automatically allocates any unassigned port of the host.

You either need to look up which host port was used docker ps or if you want to query it for a specific container: docker container inspect <containerid or name> --format '{{ json .NetworkSettings.Ports }}' .


Hi thanks for answers. Little update: i menaged to run the app by docker-compose up and through swagger, all looks correct. But when i try to use httpget endpoint to upload tags from Stack Overflow Api my database refuse connection so i’m pretty sure problem is with database. I am using Microsoft SQL Server - Ubuntu based image. I have found youtube tutorial how to connect to this running container database through Microsoft sql management studio - not working - connecton refused.