question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImageFromDockerfile.withDockerfileFromBuilder not possible to use with proxy

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bsideupcommented, Feb 21, 2022

.get() is the method

1reaction
kiviewcommented, Feb 21, 2022

Did you try the code as provided by the exception message?

DockerImageName myImage = DockerImageName.parse("localhost/testcontainers/shreetkrpuzjpwzg")
  .asCompatibleSubstituteFor("docker.elastic.co/elasticsearch/elasticsearch");

This exception happens when you start the Elasticsearch container, it has nothing to do with pulling through a proxy.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use ImageFromDockerfile.withDockerfileFromBuilder ...
For example this snippet does not work if ELASTICSEARCH_IMAGE uses an in-house/local docker proxy: ImageFromDockerfile customImage = new ...
Read more >
Creating images on-the-fly - Testcontainers for Java
Testcontainers will docker build a temporary container image, and will use it when creating the container. Dockerfile from String, file or classpath resource....
Read more >
How to build Docker Images with Dockerfile behind ...
I had a problem when corporate network was not allowing to download and setup docker image so n/w gave http proxy information. while...
Read more >
Dockerize your integration tests - DEV Community ‍ ‍
Use testcontainers to dockerize your integration tests. ... Today, it's possible to use all the power of Docker and set up a connected...
Read more >
ImageFromDockerfile.withDockerfileFromBuilder - Java
How to use. withDockerfileFromBuilder. method. in. org.testcontainers.images.builder.ImageFromDockerfile · Best Java code snippets using org.testcontainers.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found