-
Operating System: Docker for Windows. OSType: linux. Architecture: x86_64 I have an ASP.NET core web app running inside a Docker container. The below is my Dockerfile.
The app builds successfully. I also am able to create the Docker image, and run it. I want the app to be accessible at localhost:6002. I used the below command to create the container:
I see that the containers are created and running. The below is the result of docker ps:
The issue is that I am not able to access the app at Container port 6002. The below command gives connection refused:
However, if I try
I get the response. What should I do to map the host port 6002 correctly to the container port 6002? I also tried getting into the container, by using docker exec -it 0484b184aeb8 bash. I tried netstat -a, and I don’t see port 6002 in the listening list. I tried resetting Docker to factory settings, but issue still persists. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I figured out what is going on. I had to force Kestrel to listen to port 6002, by adding the below to the appsettings.json.
|
Beta Was this translation helpful? Give feedback.
-
Hey @rjosephp, Thanks a lot for coming back and posting your solution! |
Beta Was this translation helpful? Give feedback.
I figured out what is going on. I had to force Kestrel to listen to port 6002, by adding the below to the appsettings.json.