DockerCLI/cli/config
Sebastiaan van Stijn 14010c88b4 config: preserve ownership and permissions on configfile
When running `docker login` or `docker logout`, the CLI updates
the configuration file by creating a temporary file, to replace
the old one (if exists).

When using `sudo`, this caused the file to be created as `root`,
making it inaccessible to the current user.

This patch updates the CLI to fetch permissions and ownership of
the existing configuration file, and applies those permissions
to the new file, so that it has the same permissions as the
existing file (if any).

Currently, only done for "Unix-y" systems (Mac, Linux), but
can be implemented for Windows in future if there's a need.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 22a291f703)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-07-15 12:31:56 -07:00
..
configfile config: preserve ownership and permissions on configfile 2020-07-15 12:31:56 -07:00
credentials bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-04-21 16:43:18 +02:00
types Remove docker api dependency from cli/config 2019-01-31 21:25:43 +00:00
config.go config: don't call homedir on init() 2020-05-09 12:47:39 +02:00
config_test.go Update some uses of errors.Cause() to errors.Is() 2020-05-11 14:39:24 +02:00