-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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 IP address when Docker container network mode is container #2331
Fix IP address when Docker container network mode is container #2331
Conversation
394dfdd
to
741f72f
Compare
provider/docker/docker.go
Outdated
if container.NetworkSettings.NetworkMode.IsContainer() { | ||
dockerClient, err := p.createClient() | ||
if err != nil { | ||
log.Warnf("Impossible to get IP address for container %s, error: %s", container.Name, err) |
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.
Could you replace Impossible to get IP address for container...
by Unable to get IP address for container...
🇫🇷
provider/docker/docker.go
Outdated
ctx := context.Background() | ||
containerInspected, err := dockerClient.ContainerInspect(ctx, container.NetworkSettings.NetworkMode.ConnectedContainer()) | ||
if err != nil { | ||
log.Warnf("Impossible to get IP address for container %s : Failed to inspect container ID %s, error: %s", container.Name, container.NetworkSettings.NetworkMode.ConnectedContainer(), err) |
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.
Could you replace Impossible to get IP address for container...
by Unable to get IP address for container...
🇫🇷
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.
LGTM 👏
f33b320
to
0ce06b1
Compare
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.
LGTM 👏
integration/docker_test.go
Outdated
"net/http" | ||
"os" | ||
"strings" | ||
"time" | ||
|
||
"io/ioutil" |
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.
Could sort your imports?
0ce06b1
to
75a8648
Compare
75a8648
to
c710bef
Compare
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.
LGTM
c710bef
to
d18ea5b
Compare
Description
This PR allows returning an IP address for a Docker container which is in
container
network mode.Fixes #756