public CredentialRetriever dockerConfig() {
    return dockerConfig(
        DockerConfigCredentialRetriever.create(
            imageReference.getRegistry(),
            Paths.get(System.getProperty("user.home"), ".docker", "config.json")));
  }
@Test
  public void testDockerConfig() throws IOException, CredentialRetrievalException {
    CredentialRetrieverFactory credentialRetrieverFactory =
        createCredentialRetrieverFactory("registry", "repo");

    Path dockerConfig = Paths.get("/foo/config.json");
    DockerConfigCredentialRetriever dockerConfigCredentialRetriever =
        Mockito.mock(DockerConfigCredentialRetriever.class);
    Mockito.when(dockerConfigCredentialRetriever.retrieve(mockLogger))
        .thenReturn(Optional.of(FAKE_CREDENTIALS));
    Mockito.when(dockerConfigCredentialRetriever.getDockerConfigFile()).thenReturn(dockerConfig);

    Assert.assertEquals(
        Optional.of(FAKE_CREDENTIALS),
        credentialRetrieverFactory.dockerConfig(dockerConfigCredentialRetriever).retrieve());

    Mockito.verify(mockLogger)
        .accept(
            LogEvent.lifecycle(
                "Using credentials from Docker config (" + dockerConfig + ") for registry/repo"));
  }