Where is IP Address coming from? #232
-
During the Start(), I get a timeout but I am unable to find where the IP address that is being used comes from. OneTimeSetUp: Ductus.FluentDocker.Common.FluentDockerException : Timeout waiting for service at = 23.202.231.169 port = 54230
Can someone point me to where that is coming from so I can get it fixed or configured differently? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @joeutz, you can use a custom endpoint resolver. Just add Cheers, This is a sample to override the default resolver. using (
var container =
Fd.UseContainer()
.UseImage("postgres:9.6-alpine")
.WithEnvironment("POSTGRES_PASSWORD=mysecretpassword")
.ExposePort(5432)
.UseCustomResolver((
ports, portAndProto, dockerUri) =>
{
if (null == ports || string.IsNullOrEmpty(portAndProto))
return null;
if (!ports.TryGetValue(portAndProto, out var endpoints))
return null;
if (null == endpoints || endpoints.Length == 0)
return null;
if (CommandExtensions.IsNative())
return endpoints[0];
if (CommandExtensions.IsEmulatedNative())
return CommandExtensions.IsDockerDnsAvailable()
? new IPEndPoint(CommandExtensions.EmulatedNativeAddress(), endpoints[0].Port)
: new IPEndPoint(IPAddress.Loopback, endpoints[0].Port);
if (Equals(endpoints[0].Address, IPAddress.Any) && null != dockerUri)
return new IPEndPoint(IPAddress.Parse(dockerUri.Host), endpoints[0].Port);
return endpoints[0];
})
.WaitForPort("5432/tcp", 30000 /*30s*/)
.Build()
.Start())
{
var state = container.GetConfiguration(true/*force*/).State.ToServiceState();
Assert.AreEqual(ServiceRunningState.Running, state);
} The above is actually the built-in resolver... |
Beta Was this translation helpful? Give feedback.
Hi @joeutz, you can use a custom endpoint resolver. Just add
UseCustomResolver()
and provide with your own!Cheers,
Mario :)
This is a sample to override the default resolver.