-
-
Notifications
You must be signed in to change notification settings - Fork 243
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: trying to bind to an outbound ip returns an empty list of port bindings #533
Conversation
430e259
to
52fd1c9
Compare
52fd1c9
to
b88e120
Compare
if err != nil { | ||
return nil, err | ||
} | ||
const maxRetries = 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: you may verify the existence of the bug by setting maxRetries = 0
@aeneasr can you please review? |
go.mod
Outdated
@@ -14,7 +14,7 @@ require ( | |||
github.com/lib/pq v1.10.9 | |||
github.com/moby/term v0.5.0 | |||
github.com/opencontainers/image-spec v1.1.0 | |||
github.com/opencontainers/runc v1.1.13 | |||
github.com/opencontainers/runc v1.1.14 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we need upgrading runc version in this PR. It's the work for @dependabot (see #538)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc a check was failing, shall I revert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexandear here is the failing check
https://github.com/ory/dockertest/actions/runs/11347631243/job/31559482556
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The maintainer merges #538 and the fail in this branch will be gone.
dockertest.go
Outdated
for _, bindings := range c.NetworkSettings.Ports { | ||
if len(bindings) == 0 { | ||
time.Sleep(100 * time.Millisecond) | ||
return d.inspectContainerWithRetries(id, retry+1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to avoid recursion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
d0e025e
to
ba3a749
Compare
}(); !hasEmptyPortBindings { | ||
return c, nil | ||
} | ||
retryNum++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep calling docker inspect with a short delay until all port bindings are properly populated.
Related Issue or Design Document
When trying to bind to an outbound interface, the first docker inspect call right after the container has been created doesn't return port bindings properly in the response. This causes an empty host/port to be calculated by the resource.
Checklist
If this pull request addresses a security vulnerability,
I confirm that I got approval (please contact [email protected]) from the maintainers to push the changes.
Further comments