Skip to content

ImageFromDockerfile.withDockerfileFromBuilder not possible to use with proxy #5103

@nylund

Description

@nylund

Please provide a way to allow customization of an image when pulling it through a proxy. For example this snippet does not work if ELASTICSEARCH_IMAGE uses an in-house/local docker proxy:

ImageFromDockerfile customImage = new ImageFromDockerfile()
    .withDockerfileFromBuilder(builder ->
        builder
        .from(ELASTICSEARCH_IMAGE)
        .run("bin/elasticsearch-plugin", "install", "analysis-kuromoji")
        .build());

Ends up in exception:

java.lang.IllegalStateException: Failed to verify that image 'localhost/testcontainers/shreetkrpuzjpwzg' is a compatible substitute for 'docker.elastic.co/elasticsearch/elasticsearch'. This generally means that you are trying to use an image that Testcontainers has not been designed to use. If this is deliberate, and if you are confident that the image is compatible, you should declare compatibility in code using the `asCompatibleSubstituteFor` method. For example:
   DockerImageName myImage = DockerImageName.parse("localhost/testcontainers/shreetkrpuzjpwzg").asCompatibleSubstituteFor("docker.elastic.co/elasticsearch/elasticsearch");
and then use `myImage` instead.

Is there a way to turn off this type of validation?

Version: 1.16.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions