Merge pull request #494 from containous/fix-docker-network-host
Fix host Docker network
This commit is contained in:
commit
20308dc804
3 changed files with 31 additions and 3 deletions
|
@ -541,7 +541,6 @@ Labels can be used on containers to override default behaviour:
|
||||||
- `traefik.frontend.passHostHeader=true`: forward client `Host` header to the backend.
|
- `traefik.frontend.passHostHeader=true`: forward client `Host` header to the backend.
|
||||||
- `traefik.frontend.priority=10`: override default frontend priority
|
- `traefik.frontend.priority=10`: override default frontend priority
|
||||||
- `traefik.frontend.entryPoints=http,https`: assign this frontend to entry points `http` and `https`. Overrides `defaultEntryPoints`.
|
- `traefik.frontend.entryPoints=http,https`: assign this frontend to entry points `http` and `https`. Overrides `defaultEntryPoints`.
|
||||||
- `traefik.domain=traefik.localhost`: override the default domain
|
|
||||||
- `traefik.docker.network`: Set the docker network to use for connections to this container
|
- `traefik.docker.network`: Set the docker network to use for connections to this container
|
||||||
|
|
||||||
|
|
||||||
|
@ -576,7 +575,6 @@ endpoint = "http://127.0.0.1:8080"
|
||||||
watch = true
|
watch = true
|
||||||
|
|
||||||
# Default domain used.
|
# Default domain used.
|
||||||
# Can be overridden by setting the "traefik.domain" label on an application.
|
|
||||||
#
|
#
|
||||||
# Required
|
# Required
|
||||||
#
|
#
|
||||||
|
@ -638,7 +636,6 @@ Labels can be used on containers to override default behaviour:
|
||||||
- `traefik.frontend.passHostHeader=true`: forward client `Host` header to the backend.
|
- `traefik.frontend.passHostHeader=true`: forward client `Host` header to the backend.
|
||||||
- `traefik.frontend.priority=10`: override default frontend priority
|
- `traefik.frontend.priority=10`: override default frontend priority
|
||||||
- `traefik.frontend.entryPoints=http,https`: assign this frontend to entry points `http` and `https`. Overrides `defaultEntryPoints`.
|
- `traefik.frontend.entryPoints=http,https`: assign this frontend to entry points `http` and `https`. Overrides `defaultEntryPoints`.
|
||||||
- `traefik.domain=traefik.localhost`: override the default domain
|
|
||||||
|
|
||||||
|
|
||||||
## Kubernetes Ingress backend
|
## Kubernetes Ingress backend
|
||||||
|
|
|
@ -270,6 +270,13 @@ func (provider *Docker) getIPAddress(container dockertypes.ContainerJSON) string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If net==host, quick n' dirty, we return 127.0.0.1
|
||||||
|
// This will work locally, but will fail with swarm.
|
||||||
|
if container.HostConfig != nil && "host" == container.HostConfig.NetworkMode {
|
||||||
|
return "127.0.0.1"
|
||||||
|
}
|
||||||
|
|
||||||
for _, network := range container.NetworkSettings.Networks {
|
for _, network := range container.NetworkSettings.Networks {
|
||||||
return network.IPAddress
|
return network.IPAddress
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,6 +269,30 @@ func TestDockerGetIPAddress(t *testing.T) { // TODO
|
||||||
},
|
},
|
||||||
expected: "10.11.12.14",
|
expected: "10.11.12.14",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
container: docker.ContainerJSON{
|
||||||
|
ContainerJSONBase: &docker.ContainerJSONBase{
|
||||||
|
Name: "bar",
|
||||||
|
HostConfig: &container.HostConfig{
|
||||||
|
NetworkMode: "host",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Config: &container.Config{
|
||||||
|
Labels: map[string]string{},
|
||||||
|
},
|
||||||
|
NetworkSettings: &docker.NetworkSettings{
|
||||||
|
Networks: map[string]*network.EndpointSettings{
|
||||||
|
"testnet1": {
|
||||||
|
IPAddress: "10.11.12.13",
|
||||||
|
},
|
||||||
|
"testnet2": {
|
||||||
|
IPAddress: "10.11.12.14",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expected: "127.0.0.1",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, e := range containers {
|
for _, e := range containers {
|
||||||
|
|
Loading…
Add table
Reference in a new issue