Description
Discussed in testcontainers/testcontainers-dotnet#1325
Originally posted by SapiensAnatis January 1, 2025
Hi, I'm running Testcontainers in an unusual environment, which is inside an OpenSUSE distrobox and using Podman. I appreciate this is not exactly supported, but it was working beautifully until it abruptly stopped today without any configuration changes on my part.
I use this ~/.testcontainers/properties
:
ryuk.container.privileged=true
docker.host=unix:///run/user/1000/podman/podman.sock
and now whenever I run a test, it fails at container.StartAsync()
with
System.IO.IOException
Unable to read data from the transport connection: Connection reset by peer.
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
at System.Threading.Tasks.ValueTask`1.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
--- End of stack trace from previous location ---
at Docker.DotNet.MultiplexedStream.ReadOutputAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) in /_/src/Docker.DotNet/MultiplexedStream.cs:line 81
at Docker.DotNet.MultiplexedStream.CopyOutputToAsync(Stream stdin, Stream stdout, Stream stderr, CancellationToken cancellationToken) in /_/src/Docker.DotNet/MultiplexedStream.cs:line 188
at Docker.DotNet.MultiplexedStream.ReadOutputToEndAsync(CancellationToken cancellationToken) in /_/src/Docker.DotNet/MultiplexedStream.cs:line 133
at DotNet.Testcontainers.Clients.DockerContainerOperations.ExecAsync(String id, IList`1 command, CancellationToken ct) in /_/src/Testcontainers/Clients/DockerContainerOperations.cs:line 156
at Testcontainers.PostgreSql.PostgreSqlBuilder.WaitUntil.UntilAsync(IContainer container) in /_/src/Testcontainers.PostgreSql/PostgreSqlBuilder.cs:line 152
at DotNet.Testcontainers.Containers.DockerContainer.CheckReadinessAsync(WaitStrategy waitStrategy, CancellationToken ct) in /_/src/Testcontainers/Containers/DockerContainer.cs:line 542
at DotNet.Testcontainers.Configurations.WaitStrategy.<>c__DisplayClass24_0.<<WaitUntilAsync>g__UntilAsync|0>d.MoveNext() in /_/src/Testcontainers/Configurations/WaitStrategies/WaitStrategy.cs:line 184
--- End of stack trace from previous location ---
at DotNet.Testcontainers.Configurations.WaitStrategy.WaitUntilAsync(Func`1 wait, TimeSpan interval, TimeSpan timeout, Int32 retries, CancellationToken ct) in /_/src/Testcontainers/Configurations/WaitStrategies/WaitStrategy.cs:line 213
at DotNet.Testcontainers.Containers.DockerContainer.CheckReadinessAsync(IEnumerable`1 waitStrategies, CancellationToken ct) in /_/src/Testcontainers/Containers/DockerContainer.cs:line 560
at DotNet.Testcontainers.Containers.DockerContainer.UnsafeStartAsync(CancellationToken ct) in /_/src/Testcontainers/Containers/DockerContainer.cs:line 480
at DotNet.Testcontainers.Containers.DockerContainer.StartAsync(CancellationToken ct) in /_/src/Testcontainers/Containers/DockerContainer.cs:line 283
at DragaliaAPI.Integration.Test.TestContainersHelper.StartAsync() in /home/jay/Projects/Dawnshard/DragaliaAPI/DragaliaAPI.Integration.Test/TestContainersHelper.cs:line 106
at DragaliaAPI.Integration.Test.CustomWebApplicationFactory.InitializeAsync() in /home/jay/Projects/Dawnshard/DragaliaAPI/DragaliaAPI.Integration.Test/CustomWebApplicationFactory.cs:line 38
at Xunit.v3.FixtureMappingManager.GetFixture(Type fixtureType) in D:\a\xunit\xunit\src\xunit.v3.core\Utility\FixtureMappingManager.cs:line 189
What's weird is, if I use a debugger to break on the exception, the containers start correctly:
$ podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
51e225fd3f45 registry.opensuse.org/opensuse/distrobox:latest --verbose --name ... 2 months ago Up 16 minutes tumbleweed
33a944c2bd70 registry.opensuse.org/opensuse/distrobox:latest --verbose --name ... 2 months ago Up 13 minutes dotnet
ec2594b662e7 docker.io/testcontainers/ryuk:0.9.0 /bin/ryuk 28 seconds ago Up 28 seconds 0.0.0.0:36333->8080/tcp testcontainers-ryuk-6cb2078c-6760-4f10-a6b4-7f662717ac50
7bfb327b725b docker.io/library/postgres:16 -c fsync=off -c f... 28 seconds ago Up 28 seconds 0.0.0.0:33329->5432/tcp gallant_curran
756a0451f9e0 docker.io/redis/redis-stack:7.2.0-v6 /entrypoint.sh 3 seconds ago Up 3 seconds 0.0.0.0:34625->6379/tcp, 8001/tcp recursing_shtern
The last log line from Testcontainers before the exception looks something like
[testcontainers.org 00:00:08.08] Execute "pg_isready --host localhost --dbname testing --username testing" at Docker container 7bfb327b725b
except, sometimes this appears multiple times, indicating the command was issued, and sometimes the test even runs to completion, maybe about 10% of the time it passes.
I get this is probably too low-level to have anything to do with Testcontainers, but I was wondering if anyone had seen anything similar?
Activity