Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix slave provisioning errors #267

Closed
wants to merge 2 commits into from
Closed

Fix slave provisioning errors #267

wants to merge 2 commits into from

Conversation

bhuisgen
Copy link

This PR attempts to fix the problem of slave provisioning errors on a swarm cluster with a lot of images and/or containers.

Instead of inspecting all existing cluster resources, a docker tag and filter are used to list only the needed resources.

Issue: #249 + docker-java/docker-java#977

@@ -199,17 +198,9 @@ protected boolean shouldPullImage(DockerClient client, String imageName) {
return false;
}

List<Image> images = client.listImagesCmd().exec();
List<Image> images = client.listImagesCmd().withImageNameFilter(fullImageName).exec();
Copy link
Owner

Choose a reason for hiding this comment

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

now it's missing docker.io prefix check

Copy link
Author

Choose a reason for hiding this comment

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

Is it really useful to check that ? Doing it will force to inspect all images without filtering which will crash with the 1MB (or 3MB) output exception.

Copy link
Owner

Choose a reason for hiding this comment

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

When i were initially implementing docker had this prefix for images, without it image search didn't work.

Copy link
Owner

Choose a reason for hiding this comment

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

I not sure how filter works, it happens on daemon side, maybe it's dealing with this nuance

Copy link
Owner

Choose a reason for hiding this comment

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

Copy link
Owner

Choose a reason for hiding this comment

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

Well, here you can have filter (i hope it returns images with docker.io and without), but on results list you may not remove check

Copy link
Owner

Choose a reason for hiding this comment

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

$ docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 127.0.0.1:2374:2374 bobrik/socat TCP-LISTEN:2374,fork UNIX-CONNECT:/var/run/docker.sock
3945abd2b12dd549e30e285bebd0553223b84f58f1919e8af9dbac9c45185dda
$ docker pull docker.io/nginx:latest
latest: Pulling from library/nginx
0a4690c5d889: Pull complete
9719afee3eb7: Pull complete
44446b456159: Pull complete
Digest: sha256:b4b9b3eee194703fc2fa8afa5b7510c77ae70cfba567af1376a573a967c03dbb
Status: Downloaded newer image for nginx:latest

Though http://127.0.0.1:2374/v1.16/images/json doesn't show prefix. Probably prefix appears when daemon has private registry images.

@bhuisgen bhuisgen closed this by deleting the head repository Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants