How to open the docker container console and execute command in the docker container console using C# application?
This code should open the docker container console
...
CMD.ContainerShell = "exec -it {0} bash";
containerId = <ID>
...
private void RunDockerShell(string containerId)
{
processDockerShell = new Process();
processDockerShell.StartInfo.FileName = "docker.exe";
processDockerShell.StartInfo.RedirectStandardInput = true;
processDockerShell.StartInfo.RedirectStandardOutput = true;
processDockerShell.StartInfo.CreateNoWindow = false;
processDockerShell.StartInfo.UseShellExecute = false;
var CMDContainerShell = string.Format(CMD.ContainerShell, containerId);
processDockerShell.StartInfo.Arguments = CMDContainerShell;
processDockerShell.Start();
}
An error occurs after executing the processDockerShell.Start(). The error is: "the input device is not a TTY. If you are using mintty, try prefixing".
Task: Open the docker container console and execute the command
myapp --info
myapp - already installed in the docker container I'm working with.
If I just open Windows CMD and execute the following commands
docker exec -it <Id> bash
myapp --info
Then these commands are executed without error
So it looks like I'm doing something wrong in the C# code.
How to open the docker container console using C# application?