Registry authentication and credential helpers
A registry stores images and controls who may read or publish them. Authentication establishes an identity; authorization determines which repositories and operations that identity may use. A successful login is not permission to push everywhere.
Worked example
Use this worksheet offline. Names and values are fictional; no live registry, credentials, Docker daemon or external requests are needed. Commands are illustrations, not observed results. Before separately authorized verification, identify the effective Docker endpoint, client credential configuration, builder and registry destination as applicable. Never disclose credential files or private context details.
Offline example (do not execute)docker login registry.example.com --username lab-readerdocker logout registry.example.comPolicy: lab-reader can pull team/demo; cannot push team/demoThe login command accepts a registry hostname and optional port, not a repository path. The example uses a reserved fictional hostname and would prompt for credentials. Docker Hub has a device-code sign-in option. For approved automation use a narrowly scoped token supplied through a reviewed secret channel with --password-stdin; do not put it in command arguments or teaching files. A credential helper can store credentials in a platform keychain; without a suitable helper Docker may store base64-encoded credentials in its client configuration. Base64 is not encryption. Logout removes stored login information for the selected registry; it is not a guarantee of server-side token revocation. A real compromise requires revocation through the issuer. A denied push is meaningful only if an authorized positive control succeeds and the denial is due to the expected authorization policy, not DNS or TLS failure. Check the effective credential helper without displaying its contents.
Common mistake
Do not paste tokens into chat, terminal history or config examples. A private repository does not remove the need for scoped permissions.
Manual practice
Explain why lab-reader cannot push after login. Identify the right credential handling and revocation steps for a hypothetical exposed token.
Worksheet: lab-fixtures/docker-registries-and-delivery/01-authentication/scenario.txt.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Registry authentication and credential helpers — Knowledge check
Reason about image distribution and safe delivery.
Does successful login grant push permission?
What protects credentials better than base64 in a config file?
What should happen to an exposed token?