diff --git a/cli/command/image/push.go b/cli/command/image/push.go index 18b4e9ecbbc2..c2673cf19027 100644 --- a/cli/command/image/push.go +++ b/cli/command/image/push.go @@ -23,6 +23,7 @@ type pushOptions struct { remote string untrusted bool quiet bool + platform string } // NewPushCommand creates a new `docker push` command @@ -48,6 +49,7 @@ func NewPushCommand(dockerCli command.Cli) *cobra.Command { flags.BoolVarP(&opts.all, "all-tags", "a", false, "Push all tags of an image to the repository") flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Suppress verbose output") command.AddTrustSigningFlags(flags, &opts.untrusted, dockerCli.ContentTrustEnabled()) + command.AddPlatformFlag(flags, &opts.platform) return cmd } @@ -84,6 +86,7 @@ func RunPush(ctx context.Context, dockerCli command.Cli, opts pushOptions) error All: opts.all, RegistryAuth: encodedAuth, PrivilegeFunc: requestPrivilege, + Platform: opts.platform, } responseBody, err := dockerCli.Client().ImagePush(ctx, reference.FamiliarString(ref), options) diff --git a/docs/reference/commandline/image_push.md b/docs/reference/commandline/image_push.md index 283694e73eff..97e05fb3ee89 100644 --- a/docs/reference/commandline/image_push.md +++ b/docs/reference/commandline/image_push.md @@ -9,11 +9,12 @@ Upload an image to a registry ### Options -| Name | Type | Default | Description | -|:---------------------------------------------|:-------|:--------|:--------------------------------------------| -| [`-a`](#all-tags), [`--all-tags`](#all-tags) | | | Push all tags of an image to the repository | -| `--disable-content-trust` | `bool` | `true` | Skip image signing | -| `-q`, `--quiet` | | | Suppress verbose output | +| Name | Type | Default | Description | +|:---------------------------------------------|:---------|:--------|:-------------------------------------------------| +| [`-a`](#all-tags), [`--all-tags`](#all-tags) | | | Push all tags of an image to the repository | +| `--disable-content-trust` | `bool` | `true` | Skip image signing | +| `--platform` | `string` | | Set platform if server is multi-platform capable | +| `-q`, `--quiet` | | | Suppress verbose output | diff --git a/docs/reference/commandline/push.md b/docs/reference/commandline/push.md index dd93983d6018..b137c32ec4d6 100644 --- a/docs/reference/commandline/push.md +++ b/docs/reference/commandline/push.md @@ -9,11 +9,12 @@ Upload an image to a registry ### Options -| Name | Type | Default | Description | -|:--------------------------|:-------|:--------|:--------------------------------------------| -| `-a`, `--all-tags` | | | Push all tags of an image to the repository | -| `--disable-content-trust` | `bool` | `true` | Skip image signing | -| `-q`, `--quiet` | | | Suppress verbose output | +| Name | Type | Default | Description | +|:--------------------------|:---------|:--------|:-------------------------------------------------| +| `-a`, `--all-tags` | | | Push all tags of an image to the repository | +| `--disable-content-trust` | `bool` | `true` | Skip image signing | +| `--platform` | `string` | | Set platform if server is multi-platform capable | +| `-q`, `--quiet` | | | Suppress verbose output |