docker login
Signs the Docker CLI in to a registry so you can push, or pull private images.
In more detail
Use an access token rather than your password, and --password-stdin so it does not appear in shell history. Credentials are stored in a credential helper or in ~/.docker/config.json, which should be protected like any other secret. In pipelines prefer short-lived tokens.
Example
echo "$REGISTRY_TOKEN" | docker login registry.example.com -u ci-bot --password-stdinRelated terms
- registry — A server that stores images and lets clients push and pull them by name, tag or digest.
- secret — Any value that grants access, such as a password, access token or private key, and must be kept out of code and version control.
- docker push — The command that uploads a local image to a registry.
- access token — A generated string that proves who you are to a service, used instead of a password and revocable on its own.
Taught in
- Authenticate, Tag, Push And Pull From A Registry — Docker Architecture & Production Containers