Merge pull request #9698 from laurazard/dont-load-composefile-version

Overwrite parent commands PreRun code for `compose version`
This commit is contained in:
Guillaume Lours 2022-08-01 12:14:14 +02:00 committed by GitHub
commit 1eeb12fe1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -42,6 +42,11 @@ func versionCommand() *cobra.Command {
runVersion(opts)
return nil
},
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
// overwrite parent PersistentPreRunE to avoid trying to load
// compose file on version command if COMPOSE_FILE is set
return nil
},
}
// define flags for backward compatibility with com.docker.cli
flags := cmd.Flags()