summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/compat/networks.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/api/handlers/compat/networks.go')
-rw-r--r--pkg/api/handlers/compat/networks.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/pkg/api/handlers/compat/networks.go b/pkg/api/handlers/compat/networks.go
index dd28f6deb..8aab29658 100644
--- a/pkg/api/handlers/compat/networks.go
+++ b/pkg/api/handlers/compat/networks.go
@@ -2,6 +2,7 @@ package compat
import (
"encoding/json"
+ "fmt"
"net"
"net/http"
@@ -69,12 +70,20 @@ func convertLibpodNetworktoDockerNetwork(runtime *libpod.Runtime, network nettyp
return nil, err
}
if netData, ok := data.NetworkSettings.Networks[network.Name]; ok {
+ ipv4Address := ""
+ if netData.IPAddress != "" {
+ ipv4Address = fmt.Sprintf("%s/%d", netData.IPAddress, netData.IPPrefixLen)
+ }
+ ipv6Address := ""
+ if netData.GlobalIPv6Address != "" {
+ ipv6Address = fmt.Sprintf("%s/%d", netData.GlobalIPv6Address, netData.GlobalIPv6PrefixLen)
+ }
containerEndpoint := types.EndpointResource{
- Name: netData.NetworkID,
+ Name: con.Name(),
EndpointID: netData.EndpointID,
MacAddress: netData.MacAddress,
- IPv4Address: netData.IPAddress,
- IPv6Address: netData.GlobalIPv6Address,
+ IPv4Address: ipv4Address,
+ IPv6Address: ipv6Address,
}
containerEndpoints[con.ID()] = containerEndpoint
}