-
-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RedisConnectionException after updating to version 2.1.0 from 2.0.0 #607
Comments
Your setup works on my device too. Can you add the Docker logs to the issue? Can you add following builder configuration |
The additional configuration makes no difference. Docker Logs
Docker inspect output
Additional context |
The logs look good. Are you able to connect to |
I'm able to connect to
We use the connection string directly from the container:
|
Have you tried one of the latest snapshot releases? Otherwise can you checkout which commit breaks your test? There are not too many commits between 2.0.0 and 2.1.0 (a kind of binary search should find it fast). |
`DotNet.Testcontainers.Containers.ResourceReaperException' of 2.0.1
`DotNet.Testcontainers.Containers.ResourceReaperException' of 2.1.0-beta.2543038937
|
If you run the container from CLI, how does your connection string look like? |
fix(#449): Do not set HostPort to null
fix(#449): Don't let Docker Desktop for Windows choose the random public host port Since I just read it in there: I use Docker Desktop If i run the container from CLI i connect via |
Do you use Hyper-V? Maybe you run into:
What about this configuration? public sealed class GitHub : IAsyncLifetime
{
private const ushort RedisPort = 6379;
private readonly ushort randomHostPort;
private readonly ITestcontainersContainer container;
public GitHub()
{
this.randomHostPort = GetPort();
this.container = new TestcontainersBuilder<TestcontainersContainer>()
.WithImage("eqalpha/keydb:alpine")
.WithExposedPort(RedisPort)
.WithPortBinding(this.randomHostPort, RedisPort)
.Build();
}
public Task InitializeAsync()
{
return this.container.StartAsync();
}
public Task DisposeAsync()
{
return this.container.DisposeAsync().AsTask();
}
[Fact]
public Task Issue607()
{
return ConnectionMultiplexer.ConnectAsync($"{this.container.Hostname}:{this.randomHostPort}");
}
private static ushort GetPort()
{
using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
{
socket.Bind(new IPEndPoint(IPAddress.Loopback, 0));
return (ushort)((IPEndPoint)socket.LocalEndPoint).Port;
}
}
} |
I use WSL 2. I will have a look at the two issues. Your Issue607-test is successful for 2.0.0, 2.1.0 and the latest 2.2.0-Beta but fails for 2.0.1 with |
This really sounds like the mention issues above. Is Hyper-V enabled / running? See e.g. #449 (comment). |
This solved my Problem. Thanks a lot. It also solves for me the Issue docker/for-win#11584 you linked which was reproducible for me. |
Describe the bug
The connection to the container does not work with version 2.1.0, but it works with version 2.0.0.
To Reproduce
Desktop (please complete the following information):
Additional context
It works for my colleagues, but not for me.
The text was updated successfully, but these errors were encountered: