-
-
Notifications
You must be signed in to change notification settings - Fork 104
Open
Description
I'm currently unable to replicate the following non-fluent code in the Fluent API:
var id = _docker.Host.Run("mcr.microsoft.com/dotnet/sdk:6.0", new ContainerCreateParams()
{
Interactive = true,
Volumes = new []{$"{appDir}:/app", $"{nugetConfigPath}:/app/nuget.config" },
WorkingDirectory = "/app",
}, _docker.Certificates).Data;
var response = _docker.Host.Execute(id, "ls", _docker.Certificates);
//var response = _docker.Host.Execute(id, "dotnet restore /p:Configuration=Release --use-lock-file", _docker.Certificates);
_docker.Host.RemoveContainer(id);
Here's what I've tried:
var userProfileDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
var appDir = Path.Combine(userProfileDir, "code/legacy/LEAF/modules-telephonebanking/TelephoneBanking.Service");
var nugetConfigPath = Path.Combine(userProfileDir, ".nuget/NuGet/NuGet.Config");
using (var container =new Builder()
.UseContainer()
.UseImage("mcr.microsoft.com/dotnet/sdk:6.0")
.Mount(appDir,"/app", MountType.ReadWrite)
.Mount(nugetConfigPath, "/app/nuget.config", MountType.ReadOnly)
.UseWorkDir("/app")
.Build()
.Start())
{
var response = container.Execute("ls");
}
When I try this I get error messages similar to : Error response from daemon: Container e0e92da3262235e7d970ef588910e6bb4fa04c195ea6d9757285c08837aaeed7 is not running.
I can't seem to find how to run the container in interactive mode in the Fluent API.
Finally, how do I simply run an existing Dockerfile using the Fluent API? I've looked through the examples and APIs and can't seem to find how to do this.