| 629 | |
| 630 | |
| 631 | Try<Owned<Fetcher::Plugin>> DockerFetcherPlugin::create( |
| 632 | const Flags& flags, |
| 633 | bool enableAuthServiceUriFallback) |
| 634 | { |
| 635 | // TODO(jieyu): Make sure curl is available. |
| 636 | |
| 637 | hashmap<string, spec::Config::Auth> auths; |
| 638 | if (flags.docker_config.isSome()) { |
| 639 | Try<hashmap<string, spec::Config::Auth>> cachedAuths = |
| 640 | spec::parseAuthConfig(flags.docker_config.get()); |
| 641 | |
| 642 | if (cachedAuths.isError()) { |
| 643 | return Error("Failed to parse docker config: " + cachedAuths.error()); |
| 644 | } |
| 645 | |
| 646 | auths = cachedAuths.get(); |
| 647 | } |
| 648 | |
| 649 | Owned<DockerFetcherPluginProcess> process(new DockerFetcherPluginProcess( |
| 650 | hashmap<string, spec::Config::Auth>(auths), |
| 651 | flags.docker_stall_timeout, |
| 652 | enableAuthServiceUriFallback)); |
| 653 | |
| 654 | return Owned<Fetcher::Plugin>(new DockerFetcherPlugin(process)); |
| 655 | } |
| 656 | |
| 657 | |
| 658 | string DockerFetcherPlugin::getBlobPath( |