NAME 名称

podman-login - Log in to a container registry
podman-login - 登录到容器注册表

SYNOPSIS 概要

podman login [options] [registry]
podman login [选项] [注册表]

DESCRIPTION 描述

podman login logs into a specified registry server with the correct username and password. If the registry is not specified, the first registry under [registries.search] from registries.conf is used. podman login reads in the username and password from STDIN. The username and password can also be set using the username and password flags. The path of the authentication file can be specified by the user by setting the authfile flag. The default path for reading and writing credentials is ${XDG_RUNTIME_DIR}/containers/auth.json. Podman uses existing credentials if the user does not pass in a username. Podman first searches for the username and password in the ${XDG_RUNTIME_DIR}/containers/auth.json, if they are not valid, Podman then uses any existing credentials found in $HOME/.docker/config.json. If those credentials are not present, Podman creates ${XDG_RUNTIME_DIR}/containers/auth.json (if the file does not exist) and then stores the username and password from STDIN as a base64 encoded string in it. For more details about format and configurations of the auth.json file, see containers-auth.json(5)
podman login 使用正确的用户名和密码登录到指定的注册表服务器。如果未指定注册表,则使用 registries.conf 中 [registries.search] 下的第一个注册表。podman login 从 STDIN 中读取用户名和密码。也可以使用用户名和密码标志设置用户名和密码。用户可以通过设置 authfile 标志来指定认证文件的路径。读取和写入凭据的默认路径为 ${XDG_RUNTIME_DIR}/containers/auth.json。如果用户未传递用户名,Podman 将使用现有凭据。Podman 首先在 ${XDG_RUNTIME_DIR}/containers/auth.json 中搜索用户名和密码,如果它们无效,则使用 $HOME/.docker/config.json 中找到的任何现有凭据。如果这些凭据不存在,Podman 将创建 ${XDG_RUNTIME_DIR}/containers/auth.json(如果文件不存在),然后将从 STDIN 中读取的用户名和密码作为 base64 编码字符串存储在其中。有关 auth.json 文件的格式和配置的更多详细信息,请参阅 containers-auth.json(5)。

podman [GLOBAL OPTIONS] podman [全局选项]

podman login [GLOBAL OPTIONS]
podman 登录[全局选项]

podman login [OPTIONS] [REGISTRY] [GLOBAL OPTIONS]
podman 登录[选项][注册表][全局选项]

OPTIONS 选项

--authfile=path

Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json on Linux, and $HOME/.config/containers/auth.json on Windows/macOS. The file is created by podman login. If the authorization state is not found there, $HOME/.docker/config.json is checked, which is set using docker login.
认证文件的路径。在 Linux 上默认为 ${XDG_RUNTIME_DIR}/containers/auth.json ,在 Windows/macOS 上默认为 $HOME/.config/containers/auth.json 。该文件由 podman login 创建。如果授权状态未在那里找到,则会检查 $HOME/.docker/config.json ,该值是使用 docker login 设置的。

Note: There is also the option to override the default path of the authentication file by setting the REGISTRY_AUTH_FILE environment variable. This can be done with export REGISTRY_AUTH_FILE=path.
注意:还有一种选择,可以通过设置 REGISTRY_AUTH_FILE 环境变量来覆盖认证文件的默认路径。可以通过 export REGISTRY_AUTH_FILE=path 来实现。

--cert-dir=path

Use certificates at path (*.crt, *.cert, *.key) to connect to the registry. (Default: /etc/containers/certs.d) For details, see containers-certs.d(5). (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines)
使用证书路径(*.crt, *.cert, *.key)连接到注册表。 (默认值:/etc/containers/certs.d)有关详细信息,请参阅 containers-certs.d(5)。 (此选项不适用于远程 Podman 客户端,包括 Mac 和 Windows(不包括 WSL2)机器)

--compat-auth-file=path
--compat-auth-file=路径

Instead of updating the default credentials file, update the one at path, and use a Docker-compatible format.
而不是更新默认凭据文件,请更新路径中的文件,并使用与 Docker 兼容的格式。

--get-login

Return the logged-in user for the registry. Return error if no login is found.
返回注册表的已登录用户。如果未找到登录,则返回错误。

--help, -h --help,-h ¶

Print usage statement 打印使用说明

--password, -p=password
--密码, -p=密码 ¶

Password for registry 注册表密码

--password-stdin --密码-stdin ¶

Take the password from stdin
从标准输入中获取密码

--secret=name

Read the password for the registry from the podman secret name. If --username is not specified --username=name is used.
从 podman secret name 读取注册表的密码。如果未指定 --username,则使用 --username= name

--tls-verify

Require HTTPS and verify certificates when contacting registries (default: true). If explicitly set to true, TLS verification is used. If set to false, TLS verification is not used. If not specified, TLS verification is used unless the target registry is listed as an insecure registry in containers-registries.conf(5)
在联系注册表时需要 HTTPS 并验证证书(默认值为 true)。如果显式设置为 true,则使用 TLS 验证。如果设置为 false,则不使用 TLS 验证。如果未指定,则除非目标注册表在 containers-registries.conf(5) 中被列为不安全注册表,否则将使用 TLS 验证。

--username, -u=username
--用户名, -u=用户名 ¶

Username for registry 注册表的用户名

--verbose, -v --详细信息, -v ¶

print detailed information about credential store
打印有关凭据存储的详细信息

EXAMPLES 示例

Add login credentials for specified registry to default authentication file; note that unlike the docker default, the default credentials are under $XDG_RUNTIME_DIR which is a subdirectory of /run (an emphemeral directory) and hence do not persist across reboot.
将指定注册表的登录凭据添加到默认身份验证文件;请注意,与 docker 默认不同,默认凭据位于 /run 的子目录 $XDG_RUNTIME_DIR 下(一个临时目录),因此不会在重新启动后保留。

$ podman login quay.io
Username: umohnani
Password:
Login Succeeded!

To explicitly preserve credentials across reboot, you will need to specify the default persistent path:
要明确在重新启动后保留凭据,您需要指定默认持久路径:

$ podman login --authfile ~/.config/containers/auth.json quay.io
Username: umohnani
Password:
Login Succeeded!

Add login credentials using specified username and password for local registry to default authentication file.
使用指定的用户名和密码为本地注册表添加登录凭据到默认认证文件。

$ podman login -u testuser -p testpassword localhost:5000
Login Succeeded!

Add login credentials for alternate authfile path for the specified registry.
为指定的注册表添加替代 authfile 路径的登录凭据。

$ podman login --authfile authdir/myauths.json quay.io
Username: umohnani
Password:
Login Succeeded!

Add login credentials using a Podman secret for the password.
使用 Podman 密钥为密码添加登录凭据。

$ echo -n MySecret! | podman secret create secretname -
a0ad54df3c97cf89d5ca6193c
$ podman login --secret secretname -u testuser quay.io
Login Succeeded!

Add login credentials for user test with password test to localhost:5000 registry disabling tls verification requirement.
为用户 test 添加登录凭据,密码为 test,将其添加到 localhost:5000 注册表,禁用 TLS 验证要求。

$ podman login --tls-verify=false -u test -p test localhost:5000
Login Succeeded!

Add login credentials for user foo with password bar to localhost:5000 registry using the certificate directory /etc/containers/certs.d.
为用户 foo 添加登录凭据,密码为 bar,将其添加到 localhost:5000 注册表,使用证书目录/etc/containers/certs.d。

$ podman login --cert-dir /etc/containers/certs.d/ -u foo -p bar localhost:5000
Login Succeeded!

Add login credentials for specified registries to default authentication file for given user with password information provided via stdin from a file on disk.
为指定的注册表为给定用户添加登录凭据,密码信息通过 stdin 提供,从磁盘上的文件中提供。

$ podman login -u testuser  --password-stdin < testpassword.txt docker.io
Login Succeeded!

Add login credentials for specified registry to default authentication file for given user with password information provided via stdin from a pipe.
将指定注册表的登录凭据添加到给定用户的默认身份验证文件中,使用通过管道提供的密码信息。

$ echo $testpassword | podman login -u testuser --password-stdin quay.io
Login Succeeded!

Add login credentials for specified registry to default authentication file in verbose mode.
将指定注册表的登录凭据添加到默认身份验证文件中,以详细模式显示。

$ podman login quay.io --verbose
Username: myusername
Password:
Used: /run/user/1000/containers/auth.json
Login Succeeded!

SEE ALSO 参见 ¶

podman(1), podman-logout(1), containers-auth.json(5), containers-certs.d(5), containers-registries.conf(5), podman-secret(1), podman-secret-create(1)

HISTORY 历史 ¶

August 2017, Originally compiled by Urvashi Mohnani umohnani@redhat.com
2017 年 8 月,最初由 Urvashi Mohnani umohnani@redhat.com 编写