Testcontainers-java: com.github.dockerjava.api.exception.DockerClientException: Failed to parse dockerCfgFile: /Users/sscarduzio/.docker/config.json

Created on 9 Jul 2017  ·  8Comments  ·  Source: testcontainers/testcontainers-java

Now that we managed to sidestep the JVM crash (thanks!!), a new issue bubbled up.

org.testcontainers.containers.ContainerFetchException: Can't get Docker image name from org.testcontainers.images.builder.ImageFromDockerfile@1c6e0a08

    at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:739)
    at org.testcontainers.containers.GenericContainer.logger(GenericContainer.java:278)
    at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:162)
    at org.testcontainers.containers.GenericContainer.starting(GenericContainer.java:531)
    at org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:29)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: com.github.dockerjava.api.exception.DockerClientException: Failed to parse dockerCfgFile: /Users/sscarduzio/.docker/config.json
    at com.github.dockerjava.core.DefaultDockerClientConfig.getAuthConfigurations(DefaultDockerClientConfig.java:295)
    at com.github.dockerjava.netty.exec.AbstrDockerCmdExec.getBuildAuthConfigs(AbstrDockerCmdExec.java:37)
    at com.github.dockerjava.netty.exec.BuildImageCmdExec.resourceWithOptionalAuthConfig(BuildImageCmdExec.java:27)
    at com.github.dockerjava.netty.exec.BuildImageCmdExec.execute0(BuildImageCmdExec.java:107)
    at com.github.dockerjava.netty.exec.BuildImageCmdExec.execute0(BuildImageCmdExec.java:18)
    at com.github.dockerjava.netty.exec.AbstrAsyncDockerCmdExec.execute(AbstrAsyncDockerCmdExec.java:56)
    at com.github.dockerjava.netty.exec.AbstrAsyncDockerCmdExec.exec(AbstrAsyncDockerCmdExec.java:21)
    at com.github.dockerjava.netty.exec.AbstrAsyncDockerCmdExec.exec(AbstrAsyncDockerCmdExec.java:12)
    at com.github.dockerjava.core.command.AbstrAsyncDockerCmd.exec(AbstrAsyncDockerCmd.java:21)
    at org.testcontainers.images.builder.ImageFromDockerfile.resolve(ImageFromDockerfile.java:124)
    at org.testcontainers.images.builder.ImageFromDockerfile.resolve(ImageFromDockerfile.java:30)
    at org.testcontainers.utility.LazyFuture.getResolvedValue(LazyFuture.java:20)
    at org.testcontainers.utility.LazyFuture.get(LazyFuture.java:27)
    at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:737)
    ... 11 more
Caused by: java.io.IOException: Invalid Auth config file
    at com.github.dockerjava.core.AuthConfigFile.loadConfig(AuthConfigFile.java:146)
    at com.github.dockerjava.core.DefaultDockerClientConfig.getAuthConfigurations(DefaultDockerClientConfig.java:292)
    ... 24 more

I recently logged in into my docker Hub, maybe that's the cause?
$ docker -v
Docker version 17.06.0-ce, build 02c1d87

I'm running OSX El Capitan.

typbug

Most helpful comment

Oh nice, I didn't know jitpack.. BTW I tested removing that config.json file for the moment. Now it works again. Woohoo! 🚀

All 8 comments

This is my config.json

{
        "auths": {
                "https://index.docker.io/v1/": {}
        },
        "credsStore": "osxkeychain"
}

I think it's known issue, in docker-java ( https://github.com/docker-java/docker-java/issues/806 ). We upgraded docker-java dependency to 3.0.12 in 1.4.0 and going to release it really soon :D

Jitpack is also an option to try, see https://www.testcontainers.org/usage.html#maven-dependencies

Oh nice, I didn't know jitpack.. BTW I tested removing that config.json file for the moment. Now it works again. Woohoo! 🚀

@sscarduzio nice! AFAIK "credsStore": "osxkeychain" was the cause, docker-java wasn't expecting fields other than they know :D

I'm closing as a duplicate of https://github.com/testcontainers/testcontainers-java/issues/293, to be released as 1.4.0, but feel free to reopen if it doesn't help

I have the same problem with oracle-xe, but there the latest version of that is 1.2.1 Will there be a 1.4.x for oracle-xe as well, containing this fix?

There seems to be a 1.3.1, but it's not yet in MavenCentral.
As a fallback, you can always resort on the Jitpack repository.

I'll look into upgrading to 1.4.x.

修改这个文件的权限
sudo chmod 775 /Users/${user}/.docker/config.json

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oneiros-de picture oneiros-de  ·  3Comments

aruizca picture aruizca  ·  4Comments

chomhanks picture chomhanks  ·  3Comments

michael-simons picture michael-simons  ·  3Comments

dabraham02124 picture dabraham02124  ·  3Comments