Skip to content

Pull dockerhub images for tests using containerd to avoid content digest issues#2179

Open
ryanjbaxter wants to merge 1 commit intospring-cloud:3.3.xfrom
ryanjbaxter:pull-images-for-tests-using-ctr
Open

Pull dockerhub images for tests using containerd to avoid content digest issues#2179
ryanjbaxter wants to merge 1 commit intospring-cloud:3.3.xfrom
ryanjbaxter:pull-images-for-tests-using-ctr

Conversation

@ryanjbaxter
Copy link
Contributor

Previously we pulled images we needed for tests from DockerHub using Docker client saving the image as a tarball and then load them into the test container using containerd. In some situations this could result in errors when loading the image tarball with containerd using the tarball because the docker client saves the image as a tarball with references for other platforms. For example if running the tests on OSX when we save the image as a tarball using the docker client the tarball not only contains references to content digests for ARM64 but also AMD64. When containerd loads the tarball it sees those references to AMD64 but they actually are not part of the tarball and this results in content digest not found errors.

A more direct approach is to just have containerd pull the images inside the container, this not only avoids the content digest issue, but also avoid the pull, save, load steps we were doing before.

@ryanjbaxter ryanjbaxter added this to the 3.3.2 milestone Mar 12, 2026

final String[] ctrArgs = buildCtrPullArgs(fullImageRef);

await().atMost(Duration.ofMinutes(2)).pollInterval(Duration.ofSeconds(1)).until(() -> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will move to Awaitilities when I merge this forward to main

}

private static String[] buildCtrPullArgs(String fullImageRef) {
String username = System.getenv("DOCKER_HUB_USERNAME");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a small enhacement I added. One of the advantages of using the docker client on the host to pull the image was we could authenticate with docker hub. This has several benefits, one of those is to avoid being throttled. To avoid being throttled by containerd I wanted to supply creds to pull the image. If these environment properties are set and not empty we will use them as creds when pulling the image.

@ryanjbaxter
Copy link
Contributor Author

@wind57 I closed the previous PR and created one against 3.3.x. It is virtually the same with one small enhancement to supply creds to dockerhub when pulling the images

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant