Skip to content

Commit 4ce6e50

Browse files
committed
push: Don't default to DOCKER_DEFAULT_PLATFORM
Signed-off-by: Paweł Gronowski <[email protected]>
1 parent 9bb1a62 commit 4ce6e50

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

cli/command/image/push.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"encoding/json"
99
"fmt"
1010
"io"
11-
"os"
1211

1312
"github.com/containerd/platforms"
1413
"github.com/distribution/reference"
@@ -58,7 +57,11 @@ func NewPushCommand(dockerCli command.Cli) *cobra.Command {
5857
flags.BoolVarP(&opts.all, "all-tags", "a", false, "Push all tags of an image to the repository")
5958
flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Suppress verbose output")
6059
command.AddTrustSigningFlags(flags, &opts.untrusted, dockerCli.ContentTrustEnabled())
61-
flags.StringVar(&opts.platform, "platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"),
60+
61+
// Don't default to DOCKER_DEFAULT_PLATFORM env variable, always default to
62+
// pushing the image as-is. This also avoids forcing the platform selection
63+
// on older APIs which don't support it.
64+
flags.StringVar(&opts.platform, "platform", "",
6265
`Push a platform-specific manifest as a single-platform image to the registry.
6366
'os[/arch[/variant]]': Explicit platform (eg. linux/amd64)`)
6467
flags.SetAnnotation("platform", "version", []string{"1.46"})

0 commit comments

Comments
 (0)