Releases: mariotoffia/FluentDocker
Docker exec command support
Just a small addition to command to do docker exec.
Support network in docker run command
Minor update to support docker networking (--network) in dock run command.
GetContainers bug fix
This release bugfixes GetContainers where it could possibly do a NPE when a container Id was discovered during the docker ps
phase and the docker inspect phase
Check for errors in docker inspec
This is just simple fix where error code is checked in a docker inspect.
No Color in compose stream
The compose stream log can now pass the --no-color option in order to capture pure ASCII without color information.
Fix of docker compose down
This is a simple bugfix release where docker-compose down would on a ImageRemovalOption.All
do a --rmi type all
but now does --rmi all
. This fix was provided by @kroshner.
Networking & Volumes
This release brings docker networking and volumes into the commands and fluent API.
It is now possible to create networks and use those in the containers such as:
using(var nw = new Builder().UseNetwork("test-network"))
{
using (
var container =
new DockerBuilder()
.WithImage("kiasaki/alpine-postgres")
.WithEnvironment("POSTGRES_PASSWORD=mysecretpassword")
.ExposePorts("5432")
.UseNetwork(nw)
.WaitForPort("5432/tcp", 30000 /*30s*/)
.Build())
{
container.Create().Start();
}
}
The above code snippet creates a new network called test-network and then creates a container that is attached to the test-network. When the Dispose()
is called on nw it will remove the network.
In addition volume fluent API can be used such:
using (var vol = new Builder().UseVolume("test-volume").RemoveOnDispose().Build())
{
using (
var container =
new Builder().UseContainer()
.UseImage("postgres:9.6-alpine")
.WithEnvironment("POSTGRES_PASSWORD=mysecretpassword")
.MountVolume(vol, "/var/lib/postgresql/data", MountType.ReadWrite)
.Build()
.Start())
{
var config = container.GetConfiguration();
Assert.AreEqual(1, config.Mounts.Length);
Assert.AreEqual("test-volume", config.Mounts[0].Name);
}
}
The above sample creates a new volume called test-volume and it is scheduled to be delete when Dispose()
is invoked on the IVolumeService
. The container is created and mounts the newly created volume to /var/lib/postgresql/data as read/write access mode.
Since the container is within the scope of the using
statement of the volume it's lifetime spans the whole container lifetime and then get's deleted.
Happy networking & volumeing ;)
Docker Networking Support
Commands for docker networking is now available. You can create, delete, inspect, discover, attach container, and detatch containers via the commands. The create also support all advanced parameters to e.g. set IPam options etc.
This aloso comes with an enhancement form @megafinz that allows you to wait for a container to properly shut down.
Networking services and fluent API will come in a later release, but the foundation is laid for docker networking using the commands.
Bugfix in reuse container
@megafinz Fixed a bug that caused ReuseIfExist
not to work. He also added a better matching using regexp.
Strong Signed Assemblies
The fluent docker assemblies are now signed by default.
Many thanks to @skarllot for this PR.