Linux command
docker-login 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Log in to Docker Hub
docker login
Log in to Docker Hub
docker login -u [username]
Log in to a specific
docker login [registry.example.com]
Log in non-interactively
echo [token] | docker login -u [username] --password-stdin
Log in to GitHub
echo [PAT] | docker login ghcr.io -u [username] --password-stdin
说明
docker login authenticates with a Docker registry. When no server is specified, it authenticates to Docker Hub using a device code flow by default, unless --username is provided. Credentials are stored in ~/.docker/config.json or in an external credential store (such as the OS native keychain) when configured. Authentication is required to push images and access private repositories.
参数
- -u, --username _string_
- Username.
- -p, --password _string_
- Password or Personal Access Token (insecure, prefer --password-stdin).
- --password-stdin
- Take password from stdin.
FAQ
What is the docker-login command used for?
docker login authenticates with a Docker registry. When no server is specified, it authenticates to Docker Hub using a device code flow by default, unless --username is provided. Credentials are stored in ~/.docker/config.json or in an external credential store (such as the OS native keychain) when configured. Authentication is required to push images and access private repositories.
How do I run a basic docker-login example?
Run `docker login` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -u, --username _string_ do in docker-login?
Username.