Testcontainers-java: Confusing error "Can't get Docker image: XXX" with message "invalid reference format"

Created on 21 Jul 2020  路  5Comments  路  Source: testcontainers/testcontainers-java

I got a confusing message that didn't reveal a real cause of the problem.
There was an incorrect address of additional containers specified in testcontainers.properties
but the exception's stack trace and its message hide the real cause printing out information about problems with my main docker image.

Here is my stack trace

Caused by:
        org.testcontainers.containers.ContainerFetchException: Can't get Docker image: RemoteDockerImage(imageName=yandex/clickhouse-server:latest, imagePullPolicy=DefaultPullPolicy())
            at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:1279)
            at org.testcontainers.containers.GenericContainer.logger(GenericContainer.java:613)
            at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:320)
            ... 71 more

            Caused by:
            com.github.dockerjava.api.exception.BadRequestException: {"message":"invalid reference format"}
                at com.github.dockerjava.okhttp.OkHttpInvocationBuilder.execute(OkHttpInvocationBuilder.java:283)
                at com.github.dockerjava.okhttp.OkHttpInvocationBuilder.lambda$executeAndStream$4(OkHttpInvocationBuilder.java:317)
                ... 1 more

Here is a repository (https://github.com/danblack/testcontainers-confusing-error), where you can run './gradlew test' and get a stack trace I mentioned above.

But the real problem was in testcontainers.properties

tinyimage.container.image = xxx-site-xxx.com/alpine:3.5
ryuk.container.image = xxx-site-xxx.com/testcontainersofficial/ryuk:0.3.0 

There are image names that don't exist.

stale

All 5 comments

Hey @danblack,

Could you please try Testcontainers 1.15.0-rc1?

Hi, @bsideup
Almost nothing changed
```
Caused by:
org.testcontainers.containers.ContainerFetchException: Can't get Docker image: RemoteDockerImage(imageName=yandex/clickhouse-server:latest, imagePullPolicy=DefaultPullPolicy())
at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:1284)
at org.testcontainers.containers.GenericContainer.logger(GenericContainer.java:618)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:323)
... 71 more

        Caused by:
        com.github.dockerjava.api.exception.BadRequestException: Status 400: {"message":"invalid reference format"}
            at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:237)
            at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.lambda$executeAndStream$1(DefaultInvocationBuilder.java:269)

``

I'm also getting following error when running maven test goal. But same test class is working fine in intelliJ IDE.

org.testcontainers.containers.ContainerLaunchException: Container startup failed
Caused by: org.testcontainers.containers.ContainerFetchException: Can't get Docker image: RemoteDockerImage(imageName=selenium/standalone-chrome-debug:3.141.59, imagePullPolicy=DefaultPullPolicy())
Caused by: java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration

Is there any workaround for this?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this is a mistake, please reply to this comment to keep it open. If there isn't one already, a PR to fix or at least reproduce the problem in a test case will always help us get back on track to tackle this.

This issue has been automatically closed due to inactivity. We apologise if this is still an active problem for you, and would ask you to re-open the issue if this is the case.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oneiros-de picture oneiros-de  路  3Comments

aniketbhatnagar picture aniketbhatnagar  路  3Comments

McKratt picture McKratt  路  4Comments

micheal-swiggs picture micheal-swiggs  路  4Comments

andredasilvapinto picture andredasilvapinto  路  3Comments