diff --git a/api/docs/CHANGELOG.md b/api/docs/CHANGELOG.md index b0ab42e497..7b43130d1f 100644 --- a/api/docs/CHANGELOG.md +++ b/api/docs/CHANGELOG.md @@ -54,6 +54,9 @@ keywords: "API, Docker, rcli, REST, documentation" * Removed the `KernelMemoryTCP` field from the `GET /info` endpoint. * `GET /events` supports content-type negotiation and can produce either `application/x-ndjson` (Newline delimited JSON object stream) or `application/json-seq` (RFC7464). +* `POST /containers/create` no longer supports configuring a container-wide MAC address + via the container's `Config.MacAddress` field. A container's MAC address can now only + be configured via endpoint settings when connecting to a network. ## v1.51 API changes diff --git a/api/docs/v1.52.yaml b/api/docs/v1.52.yaml index e4535dc935..37cb1585a0 100644 --- a/api/docs/v1.52.yaml +++ b/api/docs/v1.52.yaml @@ -1390,13 +1390,6 @@ definitions: description: "Disable networking for the container." type: "boolean" x-nullable: true - MacAddress: - description: | - MAC address of the container. - - Deprecated: this field is deprecated in API v1.44 and up. Use EndpointSettings.MacAddress instead. - type: "string" - x-nullable: true OnBuild: description: | `ONBUILD` metadata that were defined in the image's `Dockerfile`. @@ -7882,7 +7875,6 @@ paths: /volumes/data: {} WorkingDir: "" NetworkDisabled: false - MacAddress: "12:34:56:78:9a:bc" ExposedPorts: 22/tcp: {} StopSignal: "SIGTERM" diff --git a/api/swagger.yaml b/api/swagger.yaml index e4535dc935..37cb1585a0 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -1390,13 +1390,6 @@ definitions: description: "Disable networking for the container." type: "boolean" x-nullable: true - MacAddress: - description: | - MAC address of the container. - - Deprecated: this field is deprecated in API v1.44 and up. Use EndpointSettings.MacAddress instead. - type: "string" - x-nullable: true OnBuild: description: | `ONBUILD` metadata that were defined in the image's `Dockerfile`. @@ -7882,7 +7875,6 @@ paths: /volumes/data: {} WorkingDir: "" NetworkDisabled: false - MacAddress: "12:34:56:78:9a:bc" ExposedPorts: 22/tcp: {} StopSignal: "SIGTERM" diff --git a/api/types/container/config.go b/api/types/container/config.go index 98e7c479c6..044cd33003 100644 --- a/api/types/container/config.go +++ b/api/types/container/config.go @@ -44,7 +44,7 @@ type Config struct { NetworkDisabled bool `json:",omitempty"` // Is network disabled // Mac Address of the container. // - // Deprecated: this field is deprecated since API v1.44. Use EndpointSettings.MacAddress instead. + // Deprecated: this field is deprecated since API v1.44 and obsolete since v1.52. Use EndpointSettings.MacAddress instead. MacAddress string `json:",omitempty"` OnBuild []string `json:",omitempty"` // ONBUILD metadata that were defined on the image Dockerfile Labels map[string]string // List of labels set to this container diff --git a/daemon/server/router/container/container_routes.go b/daemon/server/router/container/container_routes.go index 41b7d30828..f73271b0a2 100644 --- a/daemon/server/router/container/container_routes.go +++ b/daemon/server/router/container/container_routes.go @@ -760,6 +760,11 @@ func handleMACAddressBC(config *container.Config, hostConfig *container.HostConf if deprecatedMacAddress == "" { return "", nil } + + if versions.GreaterThanOrEqualTo(version, "1.52") { + return "", errdefs.InvalidParameter(errors.New("container-wide MAC address no longer supported; use endpoint-specific MAC address instead")) + } + var warning string if hostConfig.NetworkMode.IsBridge() || hostConfig.NetworkMode.IsUserDefined() { ep, err := epConfigForNetMode(version, hostConfig.NetworkMode, networkingConfig) diff --git a/vendor/github.com/moby/moby/api/types/container/config.go b/vendor/github.com/moby/moby/api/types/container/config.go index 98e7c479c6..044cd33003 100644 --- a/vendor/github.com/moby/moby/api/types/container/config.go +++ b/vendor/github.com/moby/moby/api/types/container/config.go @@ -44,7 +44,7 @@ type Config struct { NetworkDisabled bool `json:",omitempty"` // Is network disabled // Mac Address of the container. // - // Deprecated: this field is deprecated since API v1.44. Use EndpointSettings.MacAddress instead. + // Deprecated: this field is deprecated since API v1.44 and obsolete since v1.52. Use EndpointSettings.MacAddress instead. MacAddress string `json:",omitempty"` OnBuild []string `json:",omitempty"` // ONBUILD metadata that were defined on the image Dockerfile Labels map[string]string // List of labels set to this container