Ejemplo n.º 1
0
        public DockerBinary Resolve(string binary, bool preferMachine = false)
        {
            var type = DockerBinary.Translate(binary);

            if (preferMachine)
            {
                var m = Binaries.FirstOrDefault(x => x.IsToolbox && x.Type == type);
                if (null != m)
                {
                    return(m);
                }
            }

            switch (type)
            {
            case DockerBinaryType.Compose:
                return(MainDockerCompose);

            case DockerBinaryType.DockerClient:
                return(MainDockerClient);

            case DockerBinaryType.Machine:
                return(MainDockerMachine);

            default:
                throw new Exception($"Cannot resolve unknown binary {binary}");
            }
        }
Ejemplo n.º 2
0
        public DockerBinary Resolve(string binary, bool preferMachine = false)
        {
            var type = DockerBinary.Translate(binary);

            if (preferMachine)
            {
                var m = Binaries.FirstOrDefault(x => x.IsToolbox && x.Type == type);
                if (null != m)
                {
                    return(m);
                }
            }

            DockerBinary resolved = null;

            switch (type)
            {
            case DockerBinaryType.Compose:
                resolved = MainDockerCompose;
                break;

            case DockerBinaryType.DockerClient:
                resolved = MainDockerClient;
                break;

            case DockerBinaryType.Machine:
                resolved = MainDockerMachine;
                break;

            case DockerBinaryType.Cli:
                resolved = MainDockerCli;
                break;

            default:
                throw new FluentDockerException($"Cannot resolve unknown binary {binary}");
            }

            if (null == resolved)
            {
                throw new FluentDockerException($"Could not resolve binary {binary} is it installed on the local system?");
            }

            return(resolved);
        }