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

docker: fix bug in waiting for container to exit #24081

Merged
merged 1 commit into from
Sep 30, 2024
Merged

Conversation

tgross
Copy link
Member

@tgross tgross commented Sep 27, 2024

In ##23966 when we switched to using the official Docker SDK client, we had more contexts to add because most of the library methods take one. But for some APIs like waiting for a container to exit after we've started it, we never want to close this context, because the container can outlive the Nomad agent itself. If we close this context, the waiter fails and then we stop the container (after only running 5min).

Comment on lines +311 to +312
ctx, inspectCancel := context.WithTimeout(context.Background(), 10*time.Second)
defer inspectCancel()
Copy link
Member Author

Choose a reason for hiding this comment

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

The dockerTimeout of 5m seems ridiculous for these two API calls, which should return immediately as far as I can tell. Even 10s seems like a lot, but I don't really know what we can expect out of Docker's API here.

drivers/docker/handle.go Outdated Show resolved Hide resolved
In ##23966 when we switched to using the official Docker SDK client, we had more
contexts to add because most of the library methods take one. But for some APIs
like waiting for a container to exit after we've started it, we never want to
close this context, because the operation can outlive the Nomad agent itself.
Copy link
Contributor

@pkazmierczak pkazmierczak left a comment

Choose a reason for hiding this comment

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

LGTM!

@tgross tgross merged commit 154aeb7 into main Sep 30, 2024
25 of 26 checks passed
@tgross tgross deleted the docker-timeouts branch September 30, 2024 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants