-
-
Notifications
You must be signed in to change notification settings - Fork 104
"running" state never entered after calling GetNetworks() or GetVolumes() #253
Copy link
Copy link
Closed
Description
If I run IContainerService.GetNetworks(); or IContainerService.GetVolumes(); before I start the container then IContainerService.State never becomes ServiceRunningState.Running;
The container itself does enter the running state.
Example code:
var container =
new Ductus.FluentDocker.Builders.Builder().UseContainer()
.UseImage("alpine")
.MountVolume("test", "/dev/test", Ductus.FluentDocker.Model.Builders.MountType.ReadWrite)
.Command("tail", "-f", "/dev/null")
.KeepContainer()
.ExposePort(5432)
.WaitForPort("5432/tcp", 30000 /*30s*/)
.KeepRunning()
.Build();
container.GetNetworks(); //If I remove this line it works again
container.Start();
var test = container.State == ServiceRunningState.Running; //false
Console.ReadKey();
This workaround fixes the issue:
var container =
new Ductus.FluentDocker.Builders.Builder().UseContainer()
.UseImage("alpine")
.MountVolume("test", "/dev/test", Ductus.FluentDocker.Model.Builders.MountType.ReadWrite)
.Command("tail", "-f", "/dev/null")
.KeepContainer()
.ExposePort(5432)
.WaitForPort("5432/tcp", 30000 /*30s*/)
.KeepRunning()
.Build();
container.Start();
container.GetNetworks();
container.GetConfiguration(true); //If I add this line works
var test = container.State == ServiceRunningState.Running; //true
Console.ReadKey();
So I guess the issue is in DockerContainerService.cs:160
if (GetConfiguration().State.Running)
State = ServiceRunningState.Running;
Reactions are currently unavailable