testcontainers-dotnet: [Bug]: Testcontainers not finding the docker daemon

Testcontainers version

3.10.0

Using the latest Testcontainers version?

Yes

Host OS

macOS Ventura 13.4

Host arch

ARM - (M2 PRO chip)

.NET version

8.0

Docker version

Client: Version: 24.0.6-rd API version: 1.43 Go version: go1.20.7 Git commit: da4c87c Built: Wed Sep 6 16:40:13 2023 OS/Arch: darwin/arm64 Context: orbstack

Server: Docker Engine - Community Engine: Version: 27.3.1 API version: 1.47 (minimum version 1.24) Go version: go1.22.7 Git commit: 41ca978 Built: Fri Sep 20 11:39:57 2024 OS/Arch: linux/arm64 Experimental: false containerd: Version: v1.7.22 GitCommit: 7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c runc: Version: 1.1.14 GitCommit: 2c9f5602f0ba3d9da1c2596322dfc4e156844890 docker-init: Version: 0.19.0 GitCommit: de40ad0

Docker info

Client: Version: 24.0.6-rd Context: orbstack Debug Mode: false Plugins: buildx: Docker Buildx (Docker Inc.) Version: v0.17.1 Path: /Users/myname/.docker/cli-plugins/docker-buildx compose: Docker Compose (Docker Inc.) Version: v2.29.7 Path: /Users/myname/.docker/cli-plugins/docker-compose

Server: Containers: 29 Running: 2 Paused: 0 Stopped: 27 Images: 47 Server Version: 27.3.1 Storage Driver: overlay2 Backing Filesystem: btrfs Supports d_type: true Using metacopy: false Native Overlay Diff: true userxattr: false Logging Driver: json-file Cgroup Driver: cgroupfs Cgroup Version: 2 Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog Swarm: inactive Runtimes: io.containerd.runc.v2 runc Default Runtime: runc Init Binary: docker-init containerd version: 7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c runc version: 2c9f5602f0ba3d9da1c2596322dfc4e156844890 init version: de40ad0 Security Options: seccomp Profile: builtin cgroupns Kernel Version: 6.10.12-orbstack-00282-gd1783374c25e Operating System: OrbStack OSType: linux Architecture: aarch64 CPUs: 10 Total Memory: 9.763GiB Name: orbstack ID: e79dd471-301b-4e7a-9f68-1a0d177ec109 Docker Root Dir: /var/lib/docker Debug Mode: false Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false Product License: Community Engine Default Address Pools: Base: 192.168.97.0/24, Size: 24 Base: 192.168.107.0/24, Size: 24 Base: 192.168.117.0/24, Size: 24 Base: 192.168.147.0/24, Size: 24 Base: 192.168.148.0/24, Size: 24 Base: 192.168.155.0/24, Size: 24 Base: 192.168.156.0/24, Size: 24 Base: 192.168.158.0/24, Size: 24 Base: 192.168.163.0/24, Size: 24 Base: 192.168.164.0/24, Size: 24 Base: 192.168.165.0/24, Size: 24 Base: 192.168.166.0/24, Size: 24 Base: 192.168.167.0/24, Size: 24 Base: 192.168.171.0/24, Size: 24 Base: 192.168.172.0/24, Size: 24 Base: 192.168.181.0/24, Size: 24 Base: 192.168.183.0/24, Size: 24 Base: 192.168.186.0/24, Size: 24 Base: 192.168.207.0/24, Size: 24 Base: 192.168.214.0/24, Size: 24 Base: 192.168.215.0/24, Size: 24 Base: 192.168.216.0/24, Size: 24 Base: 192.168.223.0/24, Size: 24 Base: 192.168.227.0/24, Size: 24 Base: 192.168.228.0/24, Size: 24 Base: 192.168.229.0/24, Size: 24 Base: 192.168.237.0/24, Size: 24 Base: 192.168.239.0/24, Size: 24 Base: 192.168.242.0/24, Size: 24 Base: 192.168.247.0/24, Size: 24

What happened?

Both in Jetbrains Rider and in terminal, when I run dotnet test or run tests from inside Rider I get the this error:

System.ArgumentException: Docker is either not running or misconfigured. Please ensure that Docker is running and that the endpoint is properly config...

System.ArgumentException
Docker is either not running or misconfigured. Please ensure that Docker is running and that the endpoint is properly configured. You can customize your configuration using either the environment variables or the ~/.testcontainers.properties file. For more information, visit:
https://dotnet.testcontainers.org/custom_configuration/ (Parameter 'DockerEndpointAuthConfig')
   at DotNet.Testcontainers.Guard.ThrowIf[TType](ArgumentInfo`1& argument, Func`2 condition, Func`2 ifClause) in /_/src/Testcontainers/Guard.Null.cs:line 62
   at DotNet.Testcontainers.Builders.AbstractBuilder`4.Validate() in /_/src/Testcontainers/Builders/AbstractBuilder`4.cs:line 145
   at DotNet.Testcontainers.Builders.ContainerBuilder`3.Validate() in /_/src/Testcontainers/Builders/ContainerBuilder`3.cs:line 383
   at DotNet.Testcontainers.Builders.ContainerBuilder.Build() in /_/src/Testcontainers/Builders/ContainerBuilder.cs:line 56
   at tests.Setup.PostGISContainer..ctor(TestSettings testSettings) in /Users/myname/someproject/tests/Setup/PostGISContainer.cs:line 27
   at InvokeStub_PostGISContainer..ctor(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
   at App.Program.Main(String[] args) in /Users/ingehegge/Documents/VOLUE/spark-grid/src/App/Program.cs:line 81
   at InvokeStub_Program.Main(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Testing.DeferredHostBuilder.DeferredHost.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Start(IHost host)
   at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory`1.CreateHost(IHostBuilder builder)
   at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory`1.ConfigureHostBuilder(IHostBuilder hostBuilder)
   at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory`1.EnsureServer()
   at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory`1.get_Services()
   at tests.someproject in /Users/myname/someproject/tests/Location/LocationStorageServiceTest.cs:line 16
   at InvokeStub_LocationStorageServiceTest..ctor(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

Relevant log output

No response

Additional information

I have tried the normal stuff, restarting docker, Rider and the mac. I have tried to change the docker contexts, no difference. I have tried the equivalent of this. I know that is for Java and Colima and not dotnet and Orbstack, but I could not find the similar problem with Orbstack.

By a recommendation by a colleague, I tried to make the file ~/.testcontainers.properties containing the information:

docker.socket.override=/var/run/docker.sock
docker.host=unix:///Users/myname/.orbstack/default/docker.sock

or

docker.socket.override=/var/run/docker.sock
docker.host=unix:///Users/myname/.orbstack/run/docker.sock

but this also made no difference (one of them got another error: Hosting failed to start | System.Net.Http.HttpRequestException: Connection failed). I probably left out a bunch of important information here, but I am not sure how to make bug-reports like this (sorry). I have the newest version of Orbstack (1.7.5), if that is any helpful.

In advance, thanks for any help.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18

Most upvoted comments

The release notes don’t contain anything that seems related to the issues you mentioned, especially since the module test ran successfully. Anyway, let’s keep our fingers crossed and hope the issue is resolved and doesn’t occur anymore 🤞 🧙.

Sort of a sad update really: Monday morning Orbstack had received an update that solved my problem. Looks like in the changelog that it was an issue with Orbstack? (I don’t understand all of it). The sad part here is that I still really don’t know what is causing this error. As I said, this has happened before, and prior to this time I did not have much knowledge of docker contexts, docker environment, etc., so changes that has happened there has been out of my control. So if this error comes again, I am not really sure how to solve it, but that will be a problem for the future.

@HofmeisterAn When I was running the Testcontainers.PostgreSql.Tests in the develop branch it ran successfully. No problems. Hope this answer your question. I did not get around to testing the last part you sent there, sorry. My issue is doomed to happen again and then I will test it out!

Thanks for the help from everyone how responded. You guys can probably close this issue if wanted.