Bugfix networking release
This is a very small bugfix where static IP in a container did not work using the fluent API due to the fact that docker needs to have --network on the container in order to create it. Now it will properly do so on the first available network added to it. The following proves the point:
using (var nw = Fd.UseNetwork("unit-test-nw")
.UseSubnet("10.18.0.0/16").Build())
{
using (
var container =
Fd.UseContainer()
.WithName("mycontainer")
.UseImage("postgres:9.6-alpine")
.WithEnvironment("POSTGRES_PASSWORD=mysecretpassword")
.ExposePort(5432)
.UseNetwork(nw)
.UseIpV4("10.18.0.22")
.WaitForPort("5432/tcp", 30000 /*30s*/)
.Build()
.Start())
{
var ip = container.GetConfiguration().NetworkSettings.Networks["unit-test-nw"].IPAddress;
Assert.AreEqual("10.18.0.22", ip);
}
}
Note that it will use the first network provided in UseNetwork
as the --network parameter in docker create …
. This solves the issue #81.
Cheers,
Mario