0

我尝试使用 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");
4

1 回答 1

0

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

于 2019-06-06T07:18:21.647 回答