public override bool IsHealthy(Context context) { var console = context.Console; console.Write("Docker ... "); var cli = new DockerCli(context.Shell); try { var dockerVersion = cli.Run("--version", "getting Docker CLI version").Trim(); console.WriteLine(dockerVersion); var dockerInfo = cli.Run("info", "getting Docker info"); console.Write("Docker host OS ... "); context.Console.WriteLine(new Regex(@"Operating System:\s*(.+)", RegexOptions.Multiline) .Match(dockerInfo).Groups[1].ToString()); console.Write("Docker container OS ... "); context.Console.WriteLine(new Regex(@"OSType:\s*(.+)", RegexOptions.Multiline) .Match(dockerInfo).Groups[1].ToString()); return(true); } catch (CliException e) { context.Console.WriteLine($"!!! {e.Message}"); return(false); } catch (ShellException) { context.Console.WriteLine($"!!! {cli.Command} command not found"); return(false); } }
public void DeployService(string service) { var dockerInfo = new DockerCli(_context.Shell).Run("info", "getting Docker container OS"); var dockerOs = new Regex(@"OSType:\s*(\S+)", RegexOptions.Multiline).Match(dockerInfo).Groups[1].ToString(); DeployService(service, dockerOs); }
public void DeployService(string service) { var dockerInfo = new DockerCli(_context.Shell).Run("info", "getting Docker container OS"); var dockerOs = new Regex(@"OSType:\s*(\S+)", RegexOptions.Multiline).Match(dockerInfo).Groups[1].ToString(); DeployService(service, dockerOs); _dockerCli.Run( $"network connect {GetNetworkName()} {service}", $"attaching {service} to network"); }
internal DockerDriver(Context context) { _context = context; _dockerCli = new DockerCli(_context.Shell); _dotnetCli = new Cli("dotnet", _context.Shell); }