-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
Description
Module
Core
Testcontainers version
1.21.3
Using the latest Testcontainers version?
Yes
Host OS
macOS
Host Arch
ARM
Docker version
Client: Docker Engine - Community
Version: 28.3.2
API version: 1.47 (downgraded from 1.51)
Go version: go1.24.5
Git commit: 578ccf607d
Built: Wed Jul 9 12:04:02 2025
OS/Arch: darwin/arm64
Context: default
Server: Docker Engine - Community
Engine:
Version: 27.4.0
API version: 1.47 (minimum version 1.24)
Go version: go1.22.10
Git commit: 92a8393
Built: Sat Dec 7 10:39:01 2024
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.7.24
GitCommit: 88bf19b2105c8b17560993bee28a01ddc2f97182
runc:
Version: 1.2.2
GitCommit: v1.2.2-0-g7cb3632
docker-init:
Version: 0.19.0
GitCommit: de40ad0What happened?
If a provide an additional digest to the container names, it fails computability checks.
For example using
DockerImageName.parse("postgres:16.8")
for a org.testcontainers.containers.PostgreSQLContainer works fine.
Adding a digest using
DockerImageName.parse("postgres:16.8@sha256:301bcb60b8a3ee4ab7e147932723e3abd1cef53516ce5210b39fd9fe5e3602ae")
makes it fail.
It works again, if I manually set compatibility using
DockerImageName.parse("postgres:16.8@sha256:301bcb60b8a3ee4ab7e147932723e3abd1cef53516ce5210b39fd9fe5e3602ae").asCompatibleSubstituteFor("postgres")
I expect it to also correctly detect compatibility if the digest is present.
Relevant log output
Caused by: java.lang.IllegalStateException: Failed to verify that image 'postgres:16.8@sha256:301bcb60b8a3ee4ab7e147932723e3abd1cef53516ce5210b39fd9fe5e3602ae' is a compatible substitute for 'postgres'. This generally means that you are trying to use an image that Testcontainers has not been designed to use. If this is deliberate, and if you are confident that the image is compatible, you should declare compatibility in code using the `asCompatibleSubstituteFor` method. For example:
DockerImageName myImage = DockerImageName.parse("postgres:16.8@sha256:301bcb60b8a3ee4ab7e147932723e3abd1cef53516ce5210b39fd9fe5e3602ae").asCompatibleSubstituteFor("postgres");
and then use `myImage` instead.Additional Information
No response