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

config: print deprecation warning when falling back to ~/.dockercfg #2666

Merged

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Aug 3, 2020

follow-up to #2526

The docker CLI up until v1.7.0 used the ~/.dockercfg file to store credentials
after authenticating to a registry (docker login). Docker v1.7.0 replaced this
file with a new CLI configuration file, located in ~/.docker/config.json. When
implementing the new configuration file, the old file (and file-format) was kept
as a fall-back, to assist existing users with migrating to the new file.

Given that the old file format encourages insecure storage of credentials
(credentials are stored unencrypted), and that no version of the CLI since
Docker v1.7.0 has created this file, the file is marked deprecated, and support
for this file will be removed in a future release.

This patch adds a deprecation warning, which is printed if the CLI falls back
to using the deprecated ~/.dockercfg file.

@thaJeztah thaJeztah force-pushed the old_config_deprecation_warning branch 2 times, most recently from 1fdba4a to b473bfb Compare August 3, 2020 09:52
@thaJeztah thaJeztah force-pushed the old_config_deprecation_warning branch 4 times, most recently from ab21a50 to b431c0d Compare March 3, 2021 12:13
@thaJeztah thaJeztah added this to the 21.xx milestone Mar 3, 2021
@thaJeztah thaJeztah force-pushed the old_config_deprecation_warning branch from b431c0d to 9207469 Compare March 3, 2021 12:31
@thaJeztah thaJeztah changed the title [draft] config: print deprecation warning when falling back to ~/.dockercfg config: print deprecation warning when falling back to ~/.dockercfg Mar 3, 2021
@thaJeztah thaJeztah marked this pull request as ready for review March 3, 2021 12:32
@thaJeztah
Copy link
Member Author

@silvin-lubecki @tiborvass ptal

Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just small nit on messaging

mutex.RLock()
defer mutex.RUnlock()
if printLegacyFileWarning {
_, _ = fmt.Fprintln(stderr, "WARNING: The legacy ~/.dockercfg configuration file and file-format are deprecated and will be removed in an upcoming release")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: maybe change "will be removed" by "support will be removed"? Otherwise it could be interpreted as the config file itself will be removed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this?

Suggested change
_, _ = fmt.Fprintln(stderr, "WARNING: The legacy ~/.dockercfg configuration file and file-format are deprecated and will be removed in an upcoming release")
_, _ = fmt.Fprintln(stderr, "WARNING: Support for the legacy ~/.dockercfg configuration file and file-format is deprecated and will be removed in an upcoming release")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes thanks 👍

Relates to the deprecation, added in 3c0a167

The docker CLI up until v1.7.0 used the `~/.dockercfg` file to store credentials
after authenticating to a registry (`docker login`). Docker v1.7.0 replaced this
file with a new CLI configuration file, located in `~/.docker/config.json`. When
implementing the new configuration file, the old file (and file-format) was kept
as a fall-back, to assist existing users with migrating to the new file.

Given that the old file format encourages insecure storage of credentials
(credentials are stored unencrypted), and that no version of the CLI since
Docker v1.7.0 has created this file, the file is marked deprecated, and support
for this file will be removed in a future release.

This patch adds a deprecation warning, which is printed if the CLI falls back
to using the deprecated ~/.dockercfg file.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants