NAME

Podman-Pull-从注册表中拉出图像

SYNOPSIS

podman pull [options] source [source...]

podman image pull [options] source [source...]

podman pull [options] [transport]name[:tag|@digest]

podman image pull [options] [transport]name[:tag|@digest]

DESCRIPTION

podman pull copies an image from a registry onto the local machine. The command can pull one or more images. If the image reference in the command line argument does not contain a registry, it is referred to as ashort-name reference. If the image is a 'short-name' reference, Podman prompts the user for the specific container registry to pull the image from, if an alias for the short-name has not been specified in the short-name-aliases.conf. If an image tag is not specified, podman pull defaults to the image with the latest tag (if it exists) and pulls it. After the image is pulled, podman prints the full image ID. podman pull can also pull images using a digest podman pull image@digest and can also be used to pull images from archives and local storage using different transports. IMPORTANT: Images are stored in local image storage.

SOURCE

源是从中提取容器图像的位置。它支持所有来自 [containers-transports(5)] 。如果未指定传输,则输入将接受短名称解析,并且 docker (即,容器注册)传输被使用。对于远程客户端,包括Mac和Windows(不包括WSL2)计算机, docker 是唯一受支持的传输方式。

# Pull from a container registry
$ podman pull quay.io/username/myimage

# Pull from a container registry with short-name resolution
$ podman pull fedora

# Pull from a container registry via the docker transport
$ podman pull docker://quay.io/username/myimage

# Pull from a local directory
$ podman pull dir:/tmp/myimage

# Pull from a tarball in the docker-archive format
$ podman pull docker-archive:/tmp/myimage

# Pull from a local docker daemon
$ sudo podman pull docker-daemon:docker.io/library/myimage:33

# Pull from a tarball in the OCI-archive format
$ podman pull oci-archive:/tmp/myimage

OPTIONS

--all-tags-a

将拉出存储库中所有已标记的图像。

IMPORTANT: When using the all-tags flag, Podman does not iterate over the search registries in the * containers-registries.conf(5) * but always uses docker.io for unqualified image names.

--arch = ARCH

覆盖要拉取的映像的体系结构,默认为主机。例如, arm 。除非被覆盖,否则对本地存储中相同映像的后续查找将与此体系结构匹配,而与主机无关。

--authfile = path

身份验证文件的路径。缺省值为 ${XDG_RUNTIME_DIR}/containers/auth.json 在Linux上,以及 $HOME/.config/containers/auth.json 在Windows/MacOS上。该文件由创建 podman login 。如果在那里找不到授权状态, $HOME/.docker/config.json 被选中,它是使用 docker login

注意:还可以通过设置 REGISTRY_AUTH_FILE 环境变量这可以通过以下方式完成 export REGISTRY_AUTH_FILE=path

--cert-dir = path

在以下位置使用证书 path (\ *.crt, * .cert,\ *.key) to connect to the registry. (Default: /etc/containers/certs.d) For details, see * containers-certs.d(5) *。(此选项不适用于远程Podman客户端,包括Mac和Windows(不包括WSL2)计算机)

--creds = [[用户名[:密码]]]

这个 [username[:password] ]如有需要,可用于向登记处进行认证。如果未提供其中一个或两个值,则会出现命令行提示符并可以输入值。输入密码时没有回显。

请注意,指定的凭据仅用于针对目标注册表进行身份验证。它们不用于镜像或在重写注册表时(请参见 containers-registries.conf(5) );要针对那些考虑使用 containers-auth.json(5) 文件。

--decryption-key = [Key[:密码短语]]

这个 [key[:passphrase] ]用于图像解密。密钥可以指向密钥和/或证书。尝试使用所有密钥进行解密。如果密钥受密码短语保护,则需要在参数中传递该密钥,否则将被省略。

--disable-content-trust

这是特定于Docker的选项,用于禁用对容器注册表的镜像验证,Podman不支持。此选项是NOOP,仅用于脚本兼容性。

--help-h

打印用法说明。

--os = OS

覆盖要拉取的映像的操作系统,默认为主机。例如, windows 。除非被覆盖,否则对本地存储中相同映像的后续查找将与此操作系统匹配,而与主机无关。

--platform = OS/ARCH

指定用于选择映像的平台。(与--Arch和--os冲突) --platform 选项可用于覆盖当前的体系结构和操作系统。除非被覆盖,否则对本地存储中相同映像的后续查找将与此平台匹配,而与主机无关。

--quiet-q

在拉取图像时抑制输出信息

--retry = attempts

失败时在注册表和本地存储之间重试拉取或推送映像的次数。缺省值为 3

--retry-delay = duration

如果失败,在注册表和本地存储之间拉取或推送图像时,重试尝试之间的延迟持续时间。默认情况下,开始时间为两秒,然后以指数方式后退。设置此值时使用延迟,并且不会发生指数回退。

--tls-verify

联系注册处时要求HTTPS并验证证书(默认: true )。如果显式设置为 true ,使用TLS验证。如果设置为 false ,不使用TLS验证。如果未指定,则使用TLS验证,除非目标注册表在 containers-registries.conf(5)

--variant = VARIANT

使用 VARIANT 而不是容器映像的默认体系结构变体。某些映像可以使用ARM架构的多种变体,例如ARM/v5和ARM/v7。

FILES

short-name-aliases.conf (/var/cache/containers/short-name-aliases.conf, $HOME/.cache/containers/short-name-aliases.conf)

当用户指定的图像不包括存储该图像的容器注册表时,这称为简称。使用非限定搜索登记处会产生模棱两可的情况,因为不清楚可以从哪个登记处调出由短名称引用的特定图像。

使用短名称可能会遇到占用注册表命名空间的风险。如果未限定搜索注册表设置为 ["public-registry.com", "my-private-registry.com"] 攻击者可能会接管 public-registry.com 以使图像可以从 public-registry.com 而不是预期的来源 my-private-registry.com

虽然强烈建议始终使用完全限定的映像引用,但使用短名称的现有部署可能不容易更改。为了避免上述歧义,可以将所谓的短名称别名配置为指向完全限定的图像引用。分发版通常在/etc/tainers/Registries.conf.d/目录中附带一个默认的Shortnames.conf扩展文件。管理员可以使用此目录添加他们自己的本地短名称扩展文件。

在拉取图像时,如果用户没有指定完整的注册表,容器引擎会尝试将短名称扩展为全名。如果使用tty执行该命令,则系统会提示用户从默认列表中选择一个注册中心,该列表由registries.conf中定义的非限定注册中心组成。然后,用户的选择被存储在缓存文件中,以便在将来的所有短名称扩展中使用。根短名称存储在/var/cache/containers/short-name-aliases.conf.中无根短名称存储在$HOME/.cache/containers/short-name-aliases.conf文件中。

有关短名称的详细信息,请参阅 containers-registries.conf(5)

registries.conf (/etc/containers/registries.conf)

Registries.conf是一个配置文件,它指定在完成不包括注册表或域部分的镜像名称时参考哪些容器注册表。

注意:使用环境变量 TMPDIR 更改下载的容器图像的临时存储位置。Podman默认使用 /var/tmp

EXAMPLES

拉取一张短名称分辨率的图像。

$ podman pull alpine:latest
Resolved "alpine" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull docker.io/library/alpine:latest...
Getting image source signatures
Copying blob 5843afab3874 done
Copying config d4ff818577 done
Writing manifest to image destination
Storing signatures
d4ff818577bc193b309b355b02ebc9220427090057b54a59e73b79bdfe139b83

拉取多张带/不带短名称解析的图片。

podman pull busybox:musl alpine quay.io/libpod/cirros
Trying to pull docker.io/library/busybox:musl...
Getting image source signatures
Copying blob 0c52b060233b [--------------------------------------] 0.0b / 0.0b
Copying config 9ad2c435a8 done
Writing manifest to image destination
Storing signatures
9ad2c435a887e3f723654e09b48563de44aa3c7950246b2e9305ec85dd3422db
Trying to pull docker.io/library/alpine:latest...
Getting image source signatures
Copying blob 5843afab3874 [--------------------------------------] 0.0b / 0.0b
Copying config d4ff818577 done
Writing manifest to image destination
Storing signatures
d4ff818577bc193b309b355b02ebc9220427090057b54a59e73b79bdfe139b83
Trying to pull quay.io/libpod/cirros:latest...
Getting image source signatures
Copying blob 8da581cc9286 done
Copying blob 856628d95d17 done
Copying blob f513001ba4ab done
Copying config 3c82e4d066 done
Writing manifest to image destination
Storing signatures
3c82e4d066cf6f9e50efaead6e3ff7fddddf5527826afd68e5a969579fc4db4a

使用摘要提取图像。

$ podman pull alpine@sha256:d7342993700f8cd7aba8496c2d0e57be0666e80b4c441925fc6f9361fa81d10e
Trying to pull docker.io/library/alpine@sha256:d7342993700f8cd7aba8496c2d0e57be0666e80b4c441925fc6f9361fa81d10e...
Getting image source signatures
Copying blob 188c0c94c7c5 done
Copying config d6e46aa247 done
Writing manifest to image destination
Storing signatures
d6e46aa2470df1d32034c6707c8041158b652f38d2a9ae3d7ad7e7532d22ebe0

通过指定身份验证文件拉取图像。

$ podman pull --authfile temp-auths/myauths.json docker://docker.io/umohnani/finaltest
Trying to pull docker.io/umohnani/finaltest:latest...Getting image source signatures
Copying blob sha256:6d987f6f42797d81a318c40d442369ba3dc124883a0964d40b0c8f4f7561d913
 1.90 MB / 1.90 MB [========================================================] 0s
Copying config sha256:ad4686094d8f0186ec8249fc4917b71faa2c1030d7b5a025c29f26e19d95c156
 1.41 KB / 1.41 KB [========================================================] 0s
Writing manifest to image destination
Storing signatures
03290064078cb797f3e0a530e78c20c13dd22a3dd3adf84a5da2127b48df0438

通过向注册表进行身份验证来拉取映像。

$ podman pull --creds testuser:testpassword docker.io/umohnani/finaltest
Trying to pull docker.io/umohnani/finaltest:latest...Getting image source signatures
Copying blob sha256:6d987f6f42797d81a318c40d442369ba3dc124883a0964d40b0c8f4f7561d913
 1.90 MB / 1.90 MB [========================================================] 0s
Copying config sha256:ad4686094d8f0186ec8249fc4917b71faa2c1030d7b5a025c29f26e19d95c156
 1.41 KB / 1.41 KB [========================================================] 0s
Writing manifest to image destination
Storing signatures
03290064078cb797f3e0a530e78c20c13dd22a3dd3adf84a5da2127b48df0438

使用TLS验证拉取镜像。

$ podman pull --tls-verify=false --cert-dir image/certs docker.io/umohnani/finaltest
Trying to pull docker.io/umohnani/finaltest:latest...Getting image source signatures
Copying blob sha256:6d987f6f42797d81a318c40d442369ba3dc124883a0964d40b0c8f4f7561d913
 1.90 MB / 1.90 MB [========================================================] 0s
Copying config sha256:ad4686094d8f0186ec8249fc4917b71faa2c1030d7b5a025c29f26e19d95c156
 1.41 KB / 1.41 KB [========================================================] 0s
Writing manifest to image destination
Storing signatures
03290064078cb797f3e0a530e78c20c13dd22a3dd3adf84a5da2127b48df0438

通过覆盖主机体系结构来拉取映像。

$ podman pull --arch=arm arm32v7/debian:stretch
Trying to pull docker.io/arm32v7/debian:stretch...
Getting image source signatures
Copying blob b531ae4a3925 done
Copying config 3cba58dad5 done
Writing manifest to image destination
Storing signatures
3cba58dad5d9b35e755b48b634acb3fdd185ab1c996ac11510cc72c17780e13c

最多6次重试拉取图像,在QUET模式下,两次重试之间延迟10秒。$podman--远程拉取-q--重试6--重试-延迟10s ubi9 4d6addf62a90e392ff6d3f470259eb5667eab5b9a8e03d20b41d0ab910f92170

另请参阅

[podman(1)] , [podman-push(1)] , [podman-login(1)] , [containers-certs.d(5)] , [containers-registries.conf(5)] , [containers-transports(5)]

HISTORY

2017年7月,最初由Urvashi Mohnaniumohnani@redhat.com汇编