Skip to content

Confusing error "Can't get Docker image: XXX" with message "invalid reference format" #3010

@danblack

Description

@danblack

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions