testcontainers / testcontainers/testcontainers-java
[Bug]: Elasticsearch: Incorrectly detected OSS image
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 1.9k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 9
Description
Module
Elasticsearch
Testcontainers version
1.19.8
Using the latest Testcontainers version?
Yes
Host OS
Windows
Host Arch
amd64
Docker version
Client:
Version: 26.1.0-rd
API version: 1.44 (downgraded from 1.45)
Go version: go1.21.9
Git commit: cca8e72
Built: Tue Apr 23 16:26:59 2024
OS/Arch: windows/amd64
Context: default
Server:
Engine:
Version: 25.0.5
API version: 1.44 (minimum version 1.24)
Go version: go1.21.10
Git commit: e63daec8672d77ac0b2b5c262ef525c7cf17fd20
Built: Sun May 12 07:25:43 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.7.10
GitCommit: 4e1fe7492b9df85914c389d1f15a3ceedbb280ac
runc:
Version: 1.1.12
GitCommit: 51d5e94601ceffbbd85688df1c928ecccbfa4685
docker-init:
Version: 0.19.0
GitCommit:
What happened?
We are currently trying to use Azure Container registry (ACR) to serve as a pull through cache for Docker images. That one has quite some limitations (e.g.: https://github.com/Azure/acr/issues/599#issuecomment-1751689962), forcing us to configure the Elasticsearch Testcontainer like this (please note the library/ prefix):
elasticsearchContainer = new ElasticsearchContainer(
DockerImageName.parse("library/elasticsearch")
.asCompatibleSubstituteFor("docker.elastic.co/elasticsearch/elasticsearch")
.withTag("8.10.4")
)
This one fails, as it claims it tries to use the OSS version of Elasticsearch while activating a password, even though it is not true (it is not the OSS image...) + I override this anyway with asCompatibleSubstituteFor
Relevant log output
2024-07-05T13:50:43.285Z INFO 422 --- [dataview] [ main] ContainersSpringContextCustomizerFactory : Warming up the elastic database
2024-07-05T13:50:43.287Z WARN 422 --- [dataview] [ main] o.t.e.ElasticsearchContainer : library/elasticsearch is not supported anymore after 7.10.2. Please switch to docker.elastic.co/elasticsearch/elasticsearch
2024-07-05T13:50:43.332Z ERROR 422 --- [dataview] [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'de.mt.dataview.config.ElasticsearchTestContainer': You can not activate security on Elastic OSS Image. Please switch to the default distribution
Additional Information
Seems like the detection for isOss is could be improved - or maybe removed as it seems marked deprecated anyway...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked ElasticsearchContainer.java section around lines 108-117 and inspect how the image name is classified as OSS when using the library/elasticsearch alias. Reproduce the reported configuration with the 8.10.4 image and verify that the container no longer rejects security activation as an OSS image while preserving the compatibility warning behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, elasticsearch, java
- Domain
- databases, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100