【问题标题】:Proxy problem using testcontainers and spring-boot使用 testcontainers 和 spring-boot 的代理问题
【发布时间】:2019-10-21 01:27:36
【问题描述】:

我尝试使用testcontainers 的 docker-compose 模块编写一个 spring-boot 集成测试。我得到以下异常 启动:

java.lang.ExceptionInInitializerError
Caused by: com.github.dockerjava.api.exception.InternalServerErrorException:
{"message":"Get https://quay.io/v2/: dial tcp: lookup quay.io on 192.168.65.1:53: no such host"}

我已经尝试使用 Env 添加我们公司的 http 代理,但它不起作用。

@RunWith(SpringRunner.class)
@SpringBootTest
public class FtpExportIntegrationTest {

    @ClassRule
    public static DockerComposeContainer environment =
        new DockerComposeContainer(new File("src/test/resources/docker-compose.yml"))
            .withExposedService("search-kafka", 9092)
            .withEnv("HTTP_PROXY", "http://proxy.mycompany.com:8080")
            .withEnv("HTTPS_PROXY", "http://proxy.mycompany.com:8080")
            .withEnv("http_proxy", "http://proxy.mycompany.com:8080")
            .withEnv("https_proxy", "http://proxy.mycompany.com:8080");

【问题讨论】:

    标签: spring-boot testcontainers


    【解决方案1】:

    您需要在 Docker 守护程序设置中设置它,而不是容器。

    【讨论】:

      猜你喜欢
      • 2019-10-29
      • 2019-12-10
      • 2022-12-20
      • 2020-01-22
      • 2019-11-08
      • 2016-12-01
      • 2021-03-03
      • 2019-02-14
      • 2018-12-09
      相关资源
      最近更新 更多