Skip to content

Commit

Permalink
cli/push: Add platform switch
Browse files Browse the repository at this point in the history
Signed-off-by: Paweł Gronowski <[email protected]>
  • Loading branch information
vvoland committed Apr 5, 2024
1 parent 93d3f44 commit 8e4f543
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
3 changes: 3 additions & 0 deletions cli/command/image/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type pushOptions struct {
remote string
untrusted bool
quiet bool
platform string
}

// NewPushCommand creates a new `docker push` command
Expand All @@ -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
}
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 6 additions & 5 deletions docs/reference/commandline/image_push.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |


<!---MARKER_GEN_END-->
Expand Down
11 changes: 6 additions & 5 deletions docs/reference/commandline/push.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |


<!---MARKER_GEN_END-->
Expand Down

0 comments on commit 8e4f543

Please sign in to comment.