testcontainers/testcontainers-java · warning
is not supported anymore after 7.10.2. Please switch to
Error message
{} is not supported anymore after 7.10.2. Please switch to {} What it means
ElasticsearchContainer's constructor warns when the supplied image is compatible with docker.elastic.co/elasticsearch/elasticsearch-oss. The OSS distribution was discontinued after 7.10.2 (license change), so this image variant is no longer supported and the container warns that users should switch to the standard elasticsearch image. Execution continues with isOss=true which affects security/SSL setup.
Solutions
- Switch the image to docker.elastic.co/elasticsearch/elasticsearch:7.17.x or 8.x
- If basic (OSS-equivalent) features suffice, the standard image's free license covers them — update and remove OSS-specific config like xpack.security=false hacks
- Pin exactly 7.10.2 only if you cannot migrate yet, understanding it's end-of-life
- Consider OpenSearch's Testcontainers module if you need a truly open-source fork
Example fix
// before
new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2");
// after
new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:7.17.9"); Defensive patterns
Strategy: validation
Validate before calling
if (imageName.contains("elasticsearch-oss")) {
throw new IllegalArgumentException("OSS images unsupported after 7.10.2; use docker.elastic.co/elasticsearch/elasticsearch:<version>");
} Try / catch
// warning, not an exception — catch nothing; migrate config instead.
// Guard construction:
DockerImageName img = DockerImageName.parse("docker.elastic.co/elasticsearch/elasticsearch:8.11.0");
new ElasticsearchContainer(img); Prevention
- Replace elasticsearch-oss images with the standard elasticsearch distribution
- Pin explicit versions (7.17.x or 8.x) rather than latest
- Remove xpack.security=false style OSS-era workarounds after migrating
- Consider the OpenSearch Testcontainers module if the OSS license is a hard requirement
When it happens
Trigger: Constructing ElasticsearchContainer with an image like docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2 or a derived OSS image; image names matching elasticsearch-oss pass the assertCompatibleWith check and trigger the warning.
Common situations: Upgrading Testcontainers while still on an old OSS image from pre-7.11 setups; CI templates pinned to OSS images for licensing reasons; tutorials predating the Elastic license change.
Understand the failure class
Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.
Related errors
- CA cert under not found.
- No explicit version tag was provided in JDBC URL and this…
- Version is not a semantic version, services list is…
- This container's image does not have a healthcheck…
- is not a valid Docker image name (in )
AI-assisted analysis of testcontainers/testcontainers-java@8e549514e3 (2026-09-12).
Data as JSON: /api/errors/3c41b4498f162699.
Report an issue: GitHub.
Appendix: source
Thrown at modules/elasticsearch/src/main/java/org/testcontainers/elasticsearch/ElasticsearchContainer.java:104
*
* @param dockerImageName Full docker image name as a {@link String}, like: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
*/
public ElasticsearchContainer(String dockerImageName) {
this(DockerImageName.parse(dockerImageName));
}
/**
* Create an Elasticsearch Container by passing the full docker image name
*
* @param dockerImageName Full docker image name as a {@link DockerImageName}, like: DockerImageName.parse("docker.elastic.co/elasticsearch/elasticsearch:7.9.2")
*/
public ElasticsearchContainer(final DockerImageName dockerImageName) {
super(dockerImageName);
dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME, DEFAULT_OSS_IMAGE_NAME, ELASTICSEARCH_IMAGE_NAME);
if (dockerImageName.isCompatibleWith(DEFAULT_OSS_IMAGE_NAME)) {
this.isOss = true;
log.warn(
"{} is not supported anymore after 7.10.2. Please switch to {}",
dockerImageName.getUnversionedPart(),
DEFAULT_IMAGE_NAME.getUnversionedPart()
);
}
withEnv("discovery.type", "single-node");
// disable disk threshold checks
withEnv("cluster.routing.allocation.disk.threshold_enabled", "false");
// Sets default memory of elasticsearch instance to 2GB
// Spaces are deliberate to allow user to define additional jvm options as elasticsearch resolves option files lexicographically
withClasspathResourceMapping(
"elasticsearch-default-memory-vm.options",
"/usr/share/elasticsearch/config/jvm.options.d/ elasticsearch-default-memory-vm.options",
BindMode.READ_ONLY
);
addExposedPorts(ELASTICSEARCH_DEFAULT_PORT, ELASTICSEARCH_DEFAULT_TCP_PORT);
String versionPart = dockerImageName.getVersionPart();View on GitHub (pinned to 8e549514e3)