diff --git a/cmd/buildah/login.go b/cmd/buildah/login.go index daa315e2941..e39883c1c77 100644 --- a/cmd/buildah/login.go +++ b/cmd/buildah/login.go @@ -63,6 +63,10 @@ func loginCmd(c *cobra.Command, args []string, iopts *loginReply) error { if err != nil { return fmt.Errorf("building system context: %w", err) } + // parse.SystemContextFromOptions may point this field to an auth.json or to a .docker/config.json; + // that’s fair enough for reads, but incorrect for writes (the two files have incompatible formats), + // and it interferes with the auth.Login’s own argument parsing. + systemContext.AuthFilePath = "" ctx := getContext() iopts.loginOpts.GetLoginSet = c.Flag("get-login").Changed return auth.Login(ctx, systemContext, &iopts.loginOpts, args) diff --git a/cmd/buildah/logout.go b/cmd/buildah/logout.go index ca86ad8e03d..92117fad54c 100644 --- a/cmd/buildah/logout.go +++ b/cmd/buildah/logout.go @@ -51,5 +51,9 @@ func logoutCmd(c *cobra.Command, args []string, iopts *auth.LogoutOptions) error if err != nil { return fmt.Errorf("building system context: %w", err) } + // parse.SystemContextFromOptions may point this field to an auth.json or to a .docker/config.json; + // that’s fair enough for reads, but incorrect for writes (the two files have incompatible formats), + // and it interferes with the auth.Logout’s own argument parsing. + systemContext.AuthFilePath = "" return auth.Logout(systemContext, iopts, args) } diff --git a/docs/buildah-login.1.md b/docs/buildah-login.1.md index 05d52a1bf78..db1a67b2a2e 100644 --- a/docs/buildah-login.1.md +++ b/docs/buildah-login.1.md @@ -29,6 +29,10 @@ Path of the authentication file. Default is ${XDG_\RUNTIME\_DIR}/containers/auth Note: You can also override the default path of the authentication file by setting the REGISTRY\_AUTH\_FILE environment variable. `export REGISTRY_AUTH_FILE=path` +**--compat-auth-file**=*path* + +Instead of updating the default credentials file, update the one at *path*, and use a Docker-compatible format. + **--cert-dir** *path* Use certificates at *path* (\*.crt, \*.cert, \*.key) to connect to the registry. diff --git a/docs/buildah-logout.1.md b/docs/buildah-logout.1.md index de43a177d78..9b00e20d635 100644 --- a/docs/buildah-logout.1.md +++ b/docs/buildah-logout.1.md @@ -31,6 +31,10 @@ Path of the authentication file. Default is ${XDG_\RUNTIME\_DIR}/containers/auth Note: You can also override the default path of the authentication file by setting the REGISTRY\_AUTH\_FILE environment variable. `export REGISTRY_AUTH_FILE=path` +**--compat-auth-file**=*path* + +Instead of updating the default credentials file, update the one at *path*, and use a Docker-compatible format. + **--help**, **-h** Print usage statement