I am using TestContainers library to write integration test for my .NET 8 Blazor web app that features an ASP.NET Core 8 Web API and SQL Server database.
I have a dockerfile for the Web API and when I try to spin up the Web API in the test container, I get an exception
Docker.DotNet.DockerApiException : Docker API responded with status >code=InternalServerError, response={"message":"Get "http://localhost/v2/": dial tcp >>[::1]:80: connect: connection refused"}
The exception kind of suggests something with the registry it's trying to use to pull the image isn't quite working.
The code that creates the docker image for the TestContainer is
private readonly DockerImage image = new DockerImage("localhost/testcontainers", "MyWebApi", DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString());Has anyone got any clue as to what is going on and what is the remediation for this problem? I haven't setup any local repository separately as there is no mention of that in the TestContainers documentation.