mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
Add --config for Docker compatibility
Fixes: https://github.com/containers/podman/issues/14767 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -73,6 +73,7 @@ var (
|
|||||||
|
|
||||||
defaultLogLevel = "warn"
|
defaultLogLevel = "warn"
|
||||||
logLevel = defaultLogLevel
|
logLevel = defaultLogLevel
|
||||||
|
dockerConfig = ""
|
||||||
debug bool
|
debug bool
|
||||||
|
|
||||||
useSyslog bool
|
useSyslog bool
|
||||||
@ -85,6 +86,7 @@ func init() {
|
|||||||
loggingHook,
|
loggingHook,
|
||||||
syslogHook,
|
syslogHook,
|
||||||
earlyInitHook,
|
earlyInitHook,
|
||||||
|
configHook,
|
||||||
)
|
)
|
||||||
|
|
||||||
rootFlags(rootCmd, registry.PodmanConfig())
|
rootFlags(rootCmd, registry.PodmanConfig())
|
||||||
@ -311,6 +313,12 @@ func persistentPostRunE(cmd *cobra.Command, args []string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func configHook() {
|
||||||
|
if dockerConfig != "" {
|
||||||
|
logrus.Warn("The --config flag is ignored by Podman. Exists for Docker compatibility")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func loggingHook() {
|
func loggingHook() {
|
||||||
var found bool
|
var found bool
|
||||||
if debug {
|
if debug {
|
||||||
@ -363,6 +371,8 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) {
|
|||||||
lFlags.StringVarP(&opts.URI, "host", "H", uri, "Used for Docker compatibility")
|
lFlags.StringVarP(&opts.URI, "host", "H", uri, "Used for Docker compatibility")
|
||||||
_ = lFlags.MarkHidden("host")
|
_ = lFlags.MarkHidden("host")
|
||||||
|
|
||||||
|
lFlags.StringVar(&dockerConfig, "config", "", "Ignored for Docker compatibility")
|
||||||
|
_ = lFlags.MarkHidden("config")
|
||||||
// Context option added just for compatibility with DockerCLI.
|
// Context option added just for compatibility with DockerCLI.
|
||||||
lFlags.String("context", "default", "Name of the context to use to connect to the daemon (This flag is a NOOP and provided solely for scripting compatibility.)")
|
lFlags.String("context", "default", "Name of the context to use to connect to the daemon (This flag is a NOOP and provided solely for scripting compatibility.)")
|
||||||
_ = lFlags.MarkHidden("context")
|
_ = lFlags.MarkHidden("context")
|
||||||
|
@ -33,6 +33,7 @@ type PodmanConfig struct {
|
|||||||
*config.Config
|
*config.Config
|
||||||
*pflag.FlagSet
|
*pflag.FlagSet
|
||||||
|
|
||||||
|
DockerConfig string // Used for Docker compatibility
|
||||||
CgroupUsage string // rootless code determines Usage message
|
CgroupUsage string // rootless code determines Usage message
|
||||||
ConmonPath string // --conmon flag will set Engine.ConmonPath
|
ConmonPath string // --conmon flag will set Engine.ConmonPath
|
||||||
CPUProfile string // Hidden: Should CPU profile be taken
|
CPUProfile string // Hidden: Should CPU profile be taken
|
||||||
|
@ -29,6 +29,12 @@ function setup() {
|
|||||||
local built=$(expr "$output" : ".*Built: \+\(.*\)" | head -n1)
|
local built=$(expr "$output" : ".*Built: \+\(.*\)" | head -n1)
|
||||||
local built_t=$(date --date="$built" +%s)
|
local built_t=$(date --date="$built" +%s)
|
||||||
assert "$built_t" -gt 1546300800 "Preposterous 'Built' time in podman version"
|
assert "$built_t" -gt 1546300800 "Preposterous 'Built' time in podman version"
|
||||||
|
|
||||||
|
run_podman -v
|
||||||
|
is "$output" "podman.*version \+" "'Version line' in output"
|
||||||
|
|
||||||
|
run_podman --config foobar version
|
||||||
|
is "$output" ".*The --config flag is ignored by Podman. Exists for Docker compatibility\+" "verify warning for --config option"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "podman info" {
|
@test "podman info" {
|
||||||
|
Reference in New Issue
Block a user