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 IP address when Docker container network mode is container #2331

Merged
merged 1 commit into from
Oct 30, 2017

Conversation

nmengin
Copy link
Contributor

@nmengin nmengin commented Oct 26, 2017

Description

This PR allows returning an IP address for a Docker container which is in container network mode.

Fixes #756

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)
Copy link
Member

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... 🇫🇷

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)
Copy link
Member

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... 🇫🇷

@ldez ldez added the kind/bug/fix a bug fix label Oct 26, 2017
Copy link
Member

@mmatur mmatur left a comment

Choose a reason for hiding this comment

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

LGTM 👏

Copy link
Member

@juliens juliens left a comment

Choose a reason for hiding this comment

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

LGTM 👏

"net/http"
"os"
"strings"
"time"

"io/ioutil"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could sort your imports?

Copy link
Contributor

@ldez ldez left a comment

Choose a reason for hiding this comment

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

LGTM

@traefiker traefiker force-pushed the hotfix/docker-networkmode-container branch from c710bef to d18ea5b Compare October 30, 2017 13:18
@traefiker traefiker merged commit a0e1cf8 into traefik:v1.4 Oct 30, 2017
@nmengin nmengin deleted the hotfix/docker-networkmode-container branch August 3, 2018 12:11
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.

5 participants