docs: public RegistryConfigs authForAllRegistries(final Path configPath) throws IOException {
      checkNotNull(configPath);
  
      final DockerConfig config = MAPPER.readValue(configPath.toFile(), DockerConfig.class);
      if (config == null) {
        return RegistryConfigs.empty();
      }
  
      final RegistryConfigs.Builder registryConfigsBuilder = RegistryConfigs.builder();
  
      final Map<String, String> credHelpers = config.credHelpers();
      final boolean hasCredHelpers = credHelpers != null && !credHelpers.isEmpty();
      final Map<String, RegistryAuth> auths = config.auths();
      final boolean hasAuths = auths != null && !auths.isEmpty();
      final String credsStore = config.credsStore();
      final boolean hasCredsStore = credsStore != null;
      final Set<String> addedRegistries = new HashSet<>();
  
      // First use the credHelpers, if there are any
      if (hasCredHelpers) {
        for (final Map.Entry<String, String> credHelpersEntry : credHelpers.entrySet()) {
          final String registry = credHelpersEntry.getKey();
          final String aCredsStore = credHelpersEntry.getValue();
          if (!addedRegistries.contains(registry)) {
            addedRegistries.add(registry);
            registryConfigsBuilder.addConfig(registry,
                authWithCredentialHelper(aCredsStore, registry));
          }
        }
      }
  
      // If there are any objects in "auths", they could take two forms.
      // Older auths will map registry keys to objects with "auth" values, sometimes emails.
      // Newer auths will map registry keys to empty objects. They expect you
      // to use the credsStore to authenticate.
      if (hasAuths) {
        // We will use this empty RegistryAuth to check for empty auth values
        final RegistryAuth empty = RegistryAuth.builder().build();
  
        for (final Map.Entry<String, RegistryAuth> authEntry : auths.entrySet()) {
          final String registry = authEntry.getKey();
          if (addedRegistries.contains(registry)) {
            continue;
          }
  
          addedRegistries.add(registry);
          final RegistryAuth registryAuth = authEntry.getValue();
          if (registryAuth == null || registryAuth.equals(empty)) {
            // We have an empty object. Can we use credsStore?
            if (hasCredsStore) {
              registryConfigsBuilder.addConfig(registry,
                  authWithCredentialHelper(credsStore, registry));
            } // no else clause. If we can't fall back to credsStore, we can't auth.
          } else {
            // The auth object isn't empty.
            // We need to add the registry to its properties, then
            // add it to the RegistryConfigs
            registryConfigsBuilder.addConfig(registry,
                registryAuth.toBuilder().serverAddress(registry).build());
          }
        }
      }
  
      // If there are no credHelpers or auths or credsStore, then the
      // config may be in a very old format. There aren't any keys for different
      // sections. The file is just a map of registries to auths.
      // In other words, it looks like a RegistryConfigs.
      // If we can map it to one, we'll return it.
      if (!(hasAuths || hasCredHelpers || hasCredsStore)) {
        try {
          return MAPPER.readValue(configPath.toFile(), RegistryConfigs.class);
        } catch (IOException ignored) {
          // Looks like that failed to parse.
          // Eat the exception, fall through, and return empty object.
        }
      }
  
      return registryConfigsBuilder.build();
    }