fix: no match for platform in manifest when containerd is enabled#9200
Conversation
|
I've used redis:3.2.4-alpine using Docker Desktop for Mac M1 and the image has been downloaded and test executed successfully. Do you have a public image to reproduce the issue? |
|
Yes, Here's a simple reproducer in Kotlin: import org.testcontainers.images.RemoteDockerImage
import org.testcontainers.utility.DockerImageName
fun main() {
RemoteDockerImage(
DockerImageName.parse("gradle:8.6.0-jdk17-alpine")
).get()
} |
|
Thanks for sharing, @monosoul. However, I am not able to reproduce it on my MAC M1 using Docker Desktop and Testcontainers 1.20.1. The same image has been downloaded successfully @Test
void test() throws IOException, InterruptedException {
new RemoteDockerImage(DockerImageName.parse("gradle:8.6.0-jdk17-alpine")).get();
try (final GenericContainer<?> redis = new GenericContainer<>("gradle:8.6.0-jdk17-alpine")
.withCreateContainerCmdModifier(cmd -> cmd.withEntrypoint("sh", "-c", "while true; do sleep 1; done"))) {
redis.start();
org.testcontainers.containers.Container.ExecResult ping = redis.execInContainer("gradle", "help");
System.out.println(ping.getStdout());
}
}output: Logs show |
|
This is what I get trying to run the same test 🤔 I have a team license for Docker Desktop, I wonder if it can have anything to do with the error I get. Here's my |
|
The issue happens with containerd. Thanks for sharing the |
|
@eddumelendez glad we figured it out 🙂 |
|
@eddumelendez is this okay to merge/release? |
|
Thanks for your contribution, @monosoul ! |
Given a Docker image that only has
linux/amd64as a platformWhen I try to pull it with testcontainers on an ARM Mac
Then I should be able to pull it without any problem
Current behavior:
Trying to pull such an image causes
com.github.dockerjava.api.exception.NotFoundException.If the image manifest in the registry doesn't contain the platform it is pulled for, the registry will return 404 with the following body:
{"message":"no match for platform in manifest: not found"}. Docker-java will throwcom.github.dockerjava.api.exception.NotFoundExceptionin such case (instead ofDockerClientException), so the fallback to x86 will never be attempted.This change fixes that. I didn't dig into how to write a proper test for that and I didn't find any tests covering the exception scenario, unfortunately. Nevertheless, this will make the fallback actually work, I built it locally with the patch and confirmed it works.
Fixes #9214