Closed MrClyfar closed 10 months ago
Could you please share the output of docker images
? It seems like TC is trying to pull the image because it is not found locally (and you are running it behind a proxy that restricts the connection to https://index.docker.io/v1/
).
"docker images" output
REPOSITORY TAG IMAGE ID CREATED SIZE
mcr.microsoft.com/dotnet/sdk 6.0 4913d919cdfd 2 weeks ago 740MB
mcr.microsoft.com/dotnet/aspnet 6.0 63bd24373d54 2 weeks ago 208MB
property service 75fcb4f3ad34 2 weeks ago 239MB
mcr.microsoft.com/dotnet/sdk <none> a99f36fdc147 3 weeks ago 740MB
mcr.microsoft.com/dotnet/aspnet <none> 0fa00441382d 5 weeks ago 208MB
mcr.microsoft.com/dotnet/samples aspnetapp b3b1188392e7 5 weeks ago 115MB
We are using a proxy, it's a work network. Out of curiosity I opened a web browser and navigated to "https://index.docker.io/v1/" which returns a 404 page. Not sure if that means the url is incorrect, or maybe me accessing it like that is not correct.
Ah, this makes sense (although we should include the actual image in the Docker.DotNet exception). TC tries to pull Ryuk, our Resource Reaper image, to clean up remaining test resources. Can you try to pull the image manual:
docker pull testcontainers/ryuk:0.5.1
You can override the Docker.DotNet client properties, but I have not tested it with proxy settings yet. All the proxies I am behind allow access to the Docker Hub - AFAIK.
PS C:\src\TestContainerStuff> docker pull testcontainers/ryuk:0.5.1
Error response from daemon: Please run 'docker login'
Yeah looks blocked to me.
@HofmeisterAn Is this a case of getting a url whitelisted, or do I need to configure the unit test in order to get this to work?
I have looked into the Docker.DotNet sources, and it seems that Docker.DotNet takes into account the WebRequest.DefaultWebProxy property. I am not very familiar with this configuration. You can try to configure the default proxy before creating any resources; perhaps that helps.
Do you use a private Docker registry, either as a cache or a proxy? It is possible that the private Docker registry is configured to pull images from the upstream registries. In that case, you can utilize the TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX
configuration to automatically prepend the private Docker registry to the image.
$env:TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX="docker.example.internal"
This will pull the images from you private Docker registry. It will change the image to
docker.example.internal/testcontainers/ryuk:0.5.1
Have you been able to configure the proxy? I do not think this issue is related to Testcontainers. Do you mind if we close it? If you need further assistance, please let me know.
Unfortunately I haven't yet been able to configure the proxy, as other work commitments have taken priority. But I've seen examples of how to configure the proxy, so I just need the proxy details from our IT dept and give it a try.
However, as you point out, this is not a Testcontainers issue. I will close this issue.
Thank you for your help.
@HofmeisterAn I found the problem.
I needed to docker logout
and then docker login
but to use my Docker Hub username, and not my email address.
I got the idea from this StackOverflow answer
After logging in that way, I was able to pull the image docker.example.internal/testcontainers/ryuk:0.5.1
, which in turn fixed the issue with my unit test.
Thanks. Interesting. No proxy involved? Otherwise the Docker.DotNet
error message is quite misleading.
Testcontainers version
3.6.0
Using the latest Testcontainers version?
Yes
Host OS
Windows
Host arch
x86
.NET version
.NET 6
Docker version
Docker info
What happened?
I am trying out the Testcontainers lib with an XUnit project. Given the following constructor where I am trying to build a container using an image that is stored locally (I can see it in Docker Desktop as "property" with tag "service")
When running the unit test I get this error when executing the constructor code.
I have gone into a terminal and ran "docker login", but that did not fix the issue. I also commented out the "WithWaitStrategy" line, but that did not fix the problem.
Can someone help me with this issue please?
Relevant log output
No response
Additional information
No response