Suppose we have Docker container A running a server, and container B running a client. I can connect fine using the mosquitto_sub client with both. I also had this error using docker for windows. Despite numerous attempts it wasnt resolved by playing with the port numbers and image rebuilds, or... However, the MVC application listens to 127.0.0.1:5000 by default, which is a loopback IP address. It makes it so that localhost means the same in both. connect localhost Connection refused trying to connect to mongoDB docker … This answer is not useful. Connection refused on docker container You need to publish the exposed ports by using the following options: -P (upper case) or --publish-all that will tell Docker to use random ports from your host Menu NEWBEDEVPythonJavascriptLinuxCheat sheet Here, the client has to reach out of its container into the server container. Expand the box next to “ Time range ” and choose “ All time. docker run -d -p 8080:80 --name myapp aspnetapp Please note that the api works when I execute the following commands in command line so there is likely nothing wring with the api itself: dotnet publish -c Release -o out dotnet run out/ApiForDocker.dll EDIT: launchSettings Now that you know the IP address, try curl again. Windows Version: Windows 10 Pro; Docker Desktop Version: 2.0.1.3 (38240) Are you running inside a virtualized Windows e.g. Docker