Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --config for Docker compatibility #15658

Merged
merged 1 commit into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cmd/podman/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ var (

defaultLogLevel = "warn"
logLevel = defaultLogLevel
dockerConfig = ""
debug bool

useSyslog bool
Expand All @@ -85,6 +86,7 @@ func init() {
loggingHook,
syslogHook,
earlyInitHook,
configHook,
)

rootFlags(rootCmd, registry.PodmanConfig())
Expand Down Expand Up @@ -311,6 +313,12 @@ func persistentPostRunE(cmd *cobra.Command, args []string) error {
return nil
}

func configHook() {
if dockerConfig != "" {
logrus.Warn("The --config flag is ignored by Podman. Exists for Docker compatibility")
}
}

func loggingHook() {
var found bool
if debug {
Expand Down Expand Up @@ -363,6 +371,8 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) {
lFlags.StringVarP(&opts.URI, "host", "H", uri, "Used for Docker compatibility")
_ = lFlags.MarkHidden("host")

lFlags.StringVar(&dockerConfig, "config", "", "Ignored for Docker compatibility")
_ = lFlags.MarkHidden("config")
// 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.MarkHidden("context")
Expand Down
1 change: 1 addition & 0 deletions pkg/domain/entities/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type PodmanConfig struct {
*config.Config
*pflag.FlagSet

DockerConfig string // Used for Docker compatibility
CgroupUsage string // rootless code determines Usage message
ConmonPath string // --conmon flag will set Engine.ConmonPath
CPUProfile string // Hidden: Should CPU profile be taken
Expand Down
6 changes: 6 additions & 0 deletions test/system/001-basic.bats
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ function setup() {
local built=$(expr "$output" : ".*Built: \+\(.*\)" | head -n1)
local built_t=$(date --date="$built" +%s)
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" {
Expand Down