Skip to content

Testcontainers doesn't start the nested containers from a pod on AKS running Podman #5475

Open

Description

Hi team,
Trying to use TestContainers with Podman inside of a pod on AKS. Unfortunately, it fails to start any of the nested containers. Any idea how we can make this work?

Environment:
A pod running on AKS with the below image

FROM jenkins/inbound-agent:latest-alpine
USER root
RUN apk add podman

Testcontainers to run:

public class ElasticsearchContainerInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext>, Ordered {
    private static final String DEFAULT_TAG = "6.5.0";
    private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName
          .parse("docker.elastic.co/elasticsearch/elasticsearch")
          .withTag(DEFAULT_TAG);
    private static final ElasticsearchContainer ELASTICSEARCH_CONTAINER;
    static {
        ELASTICSEARCH_CONTAINER = new ElasticsearchContainer(DEFAULT_IMAGE_NAME);
        ELASTICSEARCH_CONTAINER.start();
    }

    public void initialize(ConfigurableApplicationContext configurableApplicationContext) {
        TestPropertyValues.of(
              "app.resources.elasticsearch.port=" + ELASTICSEARCH_CONTAINER.getMappedPort(9200),
              "app.resources.elasticsearch.host=" + ELASTICSEARCH_CONTAINER.getContainerIpAddress()
        ).applyTo(configurableApplicationContext.getEnvironment());
    }

    @Override
    public int getOrder() {
        return 0;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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