I am using Process
and ProcessStartInfo
to execute Docker
commands. However, it doesn't work for some commands. Here is the code and the example commands that I am using. All these commands work fine when executed on the Docker Toolbox
command line.
Commands:
- string command = "docker-machine create -d virtualbox --virtualbox-memory 4096 devmachine"
- string command = "docker-machine ip devmachine"
string command = "eval $(docker-machine env devmachine)"
ProcessStartInfo psi = new ProcessStartInfo(); psi.CreateNoWindow = true; psi.FileName = @"C:\Program Files\Git\bin\bash.exe"; psi.WorkingDirectory = @"C:\Program Files\Docker Toolbox"; psi.Arguments = @"--login -i ""C:\Program Files\Docker Toolbox\start.sh"" " + command; psi.UseShellExecute = false; psi.RedirectStandardOutput = true; psi.RedirectStandardInput = true; psi.RedirectStandardError = true; Process process = Process.Start(psi);
Only the 3rd command is not working, the 1st and 2nd works fine. I am wondering if there are strings that need to be escaped for the 3rd command. Only the 3rd command has the $
, (
and )
characters