diff --git a/api/swagger.yaml b/api/swagger.yaml
index 830fa4b960..4a0c874ced 100644
--- a/api/swagger.yaml
+++ b/api/swagger.yaml
@@ -1638,113 +1638,6 @@ definitions:
items:
$ref: "#/definitions/Address"
x-nullable: true
-
- # TODO properties below are part of DefaultNetworkSettings, which is
- # marked as deprecated since Docker 1.9 and to be removed in Docker v17.12
- EndpointID:
- description: |
- EndpointID uniquely represents a service endpoint in a Sandbox.
-
-
-
- > **Deprecated**: This field is only propagated when attached to the
- > default "bridge" network. Use the information from the "bridge"
- > network inside the `Networks` map instead, which contains the same
- > information. This field was deprecated in Docker 1.9 and is scheduled
- > to be removed in Docker 17.12.0
- type: "string"
- example: "b88f5b905aabf2893f3cbc4ee42d1ea7980bbc0a92e2c8922b1e1795298afb0b"
- Gateway:
- description: |
- Gateway address for the default "bridge" network.
-
-
-
- > **Deprecated**: This field is only propagated when attached to the
- > default "bridge" network. Use the information from the "bridge"
- > network inside the `Networks` map instead, which contains the same
- > information. This field was deprecated in Docker 1.9 and is scheduled
- > to be removed in Docker 17.12.0
- type: "string"
- example: "172.17.0.1"
- GlobalIPv6Address:
- description: |
- Global IPv6 address for the default "bridge" network.
-
-
-
- > **Deprecated**: This field is only propagated when attached to the
- > default "bridge" network. Use the information from the "bridge"
- > network inside the `Networks` map instead, which contains the same
- > information. This field was deprecated in Docker 1.9 and is scheduled
- > to be removed in Docker 17.12.0
- type: "string"
- example: "2001:db8::5689"
- GlobalIPv6PrefixLen:
- description: |
- Mask length of the global IPv6 address.
-
-
-
- > **Deprecated**: This field is only propagated when attached to the
- > default "bridge" network. Use the information from the "bridge"
- > network inside the `Networks` map instead, which contains the same
- > information. This field was deprecated in Docker 1.9 and is scheduled
- > to be removed in Docker 17.12.0
- type: "integer"
- example: 64
- IPAddress:
- description: |
- IPv4 address for the default "bridge" network.
-
-
-
- > **Deprecated**: This field is only propagated when attached to the
- > default "bridge" network. Use the information from the "bridge"
- > network inside the `Networks` map instead, which contains the same
- > information. This field was deprecated in Docker 1.9 and is scheduled
- > to be removed in Docker 17.12.0
- type: "string"
- example: "172.17.0.4"
- IPPrefixLen:
- description: |
- Mask length of the IPv4 address.
-
-
-
- > **Deprecated**: This field is only propagated when attached to the
- > default "bridge" network. Use the information from the "bridge"
- > network inside the `Networks` map instead, which contains the same
- > information. This field was deprecated in Docker 1.9 and is scheduled
- > to be removed in Docker 17.12.0
- type: "integer"
- example: 16
- IPv6Gateway:
- description: |
- IPv6 gateway address for this network.
-
-
-
- > **Deprecated**: This field is only propagated when attached to the
- > default "bridge" network. Use the information from the "bridge"
- > network inside the `Networks` map instead, which contains the same
- > information. This field was deprecated in Docker 1.9 and is scheduled
- > to be removed in Docker 17.12.0
- type: "string"
- example: "2001:db8:2::100"
- MacAddress:
- description: |
- MAC address for the container on the default "bridge" network.
-
-
-
- > **Deprecated**: This field is only propagated when attached to the
- > default "bridge" network. Use the information from the "bridge"
- > network inside the `Networks` map instead, which contains the same
- > information. This field was deprecated in Docker 1.9 and is scheduled
- > to be removed in Docker 17.12.0
- type: "string"
- example: "02:42:ac:11:00:04"
Networks:
description: |
Information about all networks that the container is connected to.
diff --git a/api/types/container/network_settings.go b/api/types/container/network_settings.go
index 5b98c254d7..a386081bdf 100644
--- a/api/types/container/network_settings.go
+++ b/api/types/container/network_settings.go
@@ -7,7 +7,6 @@ import (
// NetworkSettings exposes the network settings in the api
type NetworkSettings struct {
NetworkSettingsBase
- DefaultNetworkSettings
Networks map[string]*network.EndpointSettings
}
@@ -37,46 +36,6 @@ type NetworkSettingsBase struct {
SecondaryIPv6Addresses []network.Address // Deprecated: This field is never set and will be removed in a future release.
}
-// DefaultNetworkSettings holds the networking state for the default bridge, if the container is connected to that
-// network.
-//
-// Deprecated: this struct is deprecated since Docker v1.11 and will be removed in v29. You should look for the default
-// network in NetworkSettings.Networks instead.
-type DefaultNetworkSettings struct {
- // EndpointID uniquely represents a service endpoint in a Sandbox
- //
- // Deprecated: This field will be removed in v29. You should look for the default network in NetworkSettings.Networks instead.
- EndpointID string
- // Gateway holds the gateway address for the network
- //
- // Deprecated: This field will be removed in v29. You should look for the default network in NetworkSettings.Networks instead.
- Gateway string
- // GlobalIPv6Address holds network's global IPv6 address
- //
- // Deprecated: This field will be removed in v29. You should look for the default network in NetworkSettings.Networks instead.
- GlobalIPv6Address string
- // GlobalIPv6PrefixLen represents mask length of network's global IPv6 address
- //
- // Deprecated: This field will be removed in v29. You should look for the default network in NetworkSettings.Networks instead.
- GlobalIPv6PrefixLen int
- // IPAddress holds the IPv4 address for the network
- //
- // Deprecated: This field will be removed in v29. You should look for the default network in NetworkSettings.Networks instead.
- IPAddress string
- // IPPrefixLen represents mask length of network's IPv4 address
- //
- // Deprecated: This field will be removed in v29. You should look for the default network in NetworkSettings.Networks instead.
- IPPrefixLen int
- // IPv6Gateway holds gateway address specific for IPv6
- //
- // Deprecated: This field will be removed in v29. You should look for the default network in NetworkSettings.Networks instead.
- IPv6Gateway string
- // MacAddress holds the MAC address for the network
- //
- // Deprecated: This field will be removed in v29. You should look for the default network in NetworkSettings.Networks instead.
- MacAddress string
-}
-
// NetworkSettingsSummary provides a summary of container's networks
// in /containers/json
type NetworkSettingsSummary struct {
diff --git a/daemon/server/router/container/inspect.go b/daemon/server/router/container/inspect.go
index f249e3ab9a..e5610a0bdb 100644
--- a/daemon/server/router/container/inspect.go
+++ b/daemon/server/router/container/inspect.go
@@ -5,7 +5,9 @@ import (
"net/http"
"github.com/moby/moby/api/types/container"
+ "github.com/moby/moby/api/types/network"
"github.com/moby/moby/api/types/versions"
+ "github.com/moby/moby/v2/daemon/internal/compat"
"github.com/moby/moby/v2/daemon/internal/sliceutil"
"github.com/moby/moby/v2/daemon/internal/stringid"
"github.com/moby/moby/v2/daemon/server/backend"
@@ -34,5 +36,24 @@ func (c *containerRouter) getContainersByName(ctx context.Context, w http.Respon
ctr.ImageManifestDescriptor = nil
}
- return httputils.WriteJSON(w, http.StatusOK, ctr)
+ var bridgeNw network.EndpointSettings
+ if v := ctr.NetworkSettings.Networks["bridge"]; v != nil {
+ bridgeNw = *v
+ }
+
+ var wrapOpts []compat.Option
+ if versions.LessThan(version, "1.52") {
+ wrapOpts = append(wrapOpts, compat.WithExtraFields(map[string]any{
+ "EndpointID": bridgeNw.EndpointID,
+ "Gateway": bridgeNw.Gateway,
+ "GlobalIPv6Address": bridgeNw.GlobalIPv6Address,
+ "GlobalIPv6PrefixLen": bridgeNw.GlobalIPv6PrefixLen,
+ "IPAddress": bridgeNw.IPAddress,
+ "IPPrefixLen": bridgeNw.IPPrefixLen,
+ "IPv6Gateway": bridgeNw.IPv6Gateway,
+ "MacAddress": bridgeNw.MacAddress,
+ }))
+ }
+
+ return httputils.WriteJSON(w, http.StatusOK, compat.Wrap(ctr, wrapOpts...))
}