Bugfix and Small Enhancements
Fixed bug so Docker-Compose
is allowed to execute on remote host. Also Hyper-V docker host service (docker-machine
) do require elevated process nowadays. A workaround since docker-machine inspect machine-name
do return a valid MachineInfo
data and therefore can calculate the URL and set it to Running. Thus, it is not necessary to elevate the process when doing Hyper-V machines in the DockerHostService
.
It is now possible to set explicit container IP both for V4 and V6. This was added to the ContainerCreateParams
and therefore it is possible to supply those both in create or run command such as
var cmd = _docker.Run("postgres:9.6-alpine", new ContainerCreateParams
{
PortMappings = new[] {"40001:5432"},
Environment = new[] {"POSTGRES_PASSWORD=mysecretpassword"},
Network = "mynetwork",
Ipv4 = "1.1.1.1"
}, _certificates);
var container = cmd.Data;
var insp = _docker.InspectContainer(container, _certificates);
var ip = insp.Data.NetworkSettings.IPAddress;
Assert.AreEqual("1.1.1.1", ip);
The above example will create a new container using network mynetwork and set the static IP of 1.1.1.1. The fluent API would looks like this:
using (var nw = Fd.UseNetwork("mynetwork").Build())
{
using (
var container =
Fd.UseContainer()
.WithName("mycontainer")
.UseImage("postgres:9.6-alpine")
.WithEnvironment("POSTGRES_PASSWORD=mysecretpassword")
.ExposePort(5432)
.UseNetwork(nw)
.UseIpV4("1.1.1.1")
.WaitForPort("5432/tcp", 30000 /*30s*/)
.Build()
.Start())
{
var ip = container.GetConfiguration().NetworkSettings.IPAddress;
Assert.AreEqual("1.1.1.1", ip);
}
}
It also contains the beginning of docker stack
support. However, it will be finished in a later version and shall not be relied upon (in any way!).
Cheers,
Mario