class DockerConfig {

  @Nullable
  DockerCredentialHelper getCredentialHelperFor(String registry) {
    List<Predicate<String>> registryMatchers = getRegistryMatchersFor(registry);

    Map.Entry<String, String> firstCredHelperMatch =
        findFirstInMapByKey(dockerConfigTemplate.getCredHelpers(), registryMatchers);
    if (firstCredHelperMatch != null) {
      return new DockerCredentialHelper(
          firstCredHelperMatch.getKey(),
          Paths.get("docker-credential-" + firstCredHelperMatch.getValue()));
    }

    if (dockerConfigTemplate.getCredsStore() != null) {
      return new DockerCredentialHelper(
          registry, Paths.get("docker-credential-" + dockerConfigTemplate.getCredsStore()));
    }

    return null;
  }

    DockerConfig(DockerConfigTemplate dockerConfigTemplate);

}