Need help with writing an interactive client
- Dominant language
- C#
- Stars
- 2.4k
- Forks
- 416
- PR merge metrics
- No merged PRs in 30d
Description
Currently i am trying to write an interactive client, like the terminal in Docker Desktop.
I tried the approch from Ticket #479 , but this would lead to crash of the pipline or no result.
Could anyone provide a better documentation from the exec interface or sample? I made also a sample, but this wouldn't work in my case. I want it to be like a ssh console.
```
public static async Task SendCommand(DockerClient client, string msysql, string command)
{
var execCreateParameters = new ContainerExecCreateParameters
{
Cmd = command.Split(' '),
AttachStdin = true,
AttachStdout = true,
AttachStderr = true,
};
var execCreateResponse = await client.Exec.ExecCreateContainerAsync(msysql, execCreateParameters, default(CancellationToken));
using (var stdOutAndErrStream = await client.Exec.StartAndAttachContainerExecAsync(execCreateResponse.ID, false, default(CancellationToken)))
{
var (stdout, stderr) = await stdOutAndErrStream.ReadOutputToEndAsync(default(CancellationToken));
var execInspectResponse = await client.Exec.InspectContainerExecAsync(execCreateResponse.ID, default(CancellationToken));
Console.WriteLine($"Standard Out: {stdout}");
Console.WriteLine($"Standard Error: {stderr}");
Console.WriteLine($"Exit Code: {execInspectResponse.ExitCode}");
Console.Read();
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.