LinuxCommandLibrary

docker-login

authenticate with Docker registries

TLDR

Log in to Docker Hub

$ docker login
copy
Log in to specific registry
$ docker login [registry.example.com]
copy
Log in with username
$ docker login -u [username]
copy
Log in non-interactively
$ echo [password] | docker login -u [username] --password-stdin
copy

SYNOPSIS

docker login [options] [server]

DESCRIPTION

docker login authenticates with a Docker registry. Credentials are stored in ~/.docker/config.json. Defaults to Docker Hub if no server specified. Authentication is required to push images and access private repositories. The command supports various registry providers including Docker Hub, GitHub Container Registry, and private registries.

PARAMETERS

-u, --username string

Username.
-p, --password string
Password (insecure, prefer --password-stdin).
--password-stdin
Take password from stdin.

CONFIGURATION

~/.docker/config.json

Stores registry credentials and authentication tokens. Uses credential helpers for secure storage when available.

CAVEATS

Using -p exposes password in shell history. Always prefer --password-stdin for scripted logins.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community