diff --git a/cli/command/image/build.go b/cli/command/image/build.go index 5e57778f19..64b51113c0 100644 --- a/cli/command/image/build.go +++ b/cli/command/image/build.go @@ -113,25 +113,6 @@ func NewBuildCommand(dockerCli command.Cli) *cobra.Command { }, } - // Wrap the global pre-run to handle non-BuildKit use of the --platform flag. - // - // We're doing it here so that we're only contacting the daemon when actually - // running the command, and not during initialization. - // TODO remove this hack once we no longer support the experimental use of --platform - rootFn := cmd.Root().PersistentPreRunE - cmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error { - if ok, _ := command.BuildKitEnabled(dockerCli.ServerInfo()); !ok { - f := cmd.Flag("platform") - delete(f.Annotations, "buildkit") - f.Annotations["version"] = []string{"1.32"} - f.Annotations["experimental"] = nil - } - if rootFn != nil { - return rootFn(cmd, args) - } - return nil - } - flags := cmd.Flags() flags.VarP(&options.tags, "tag", "t", "Name and optionally a tag in the 'name:tag' format") diff --git a/cli/command/utils.go b/cli/command/utils.go index ec89062d37..dff881f49e 100644 --- a/cli/command/utils.go +++ b/cli/command/utils.go @@ -125,7 +125,6 @@ func PruneFilters(dockerCli Cli, pruneFilters filters.Args) filters.Args { func AddPlatformFlag(flags *pflag.FlagSet, target *string) { flags.StringVar(target, "platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Set platform if server is multi-platform capable") flags.SetAnnotation("platform", "version", []string{"1.32"}) - flags.SetAnnotation("platform", "experimental", nil) } // ValidateOutputPath validates the output paths of the `export` and `save` commands.