containers.podman.podman_import 模块 – 从 tar 文件导入 Podman 容器。

注意

此模块是 containers.podman 集合(版本 1.16.2)的一部分。

如果您正在使用 ansible 包,您可能已经安装了这个集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install containers.podman。您需要满足其他要求才能使用此模块,请参阅 要求 了解详细信息。

要在剧本中使用它,请指定:containers.podman.podman_import

概要

  • podman import 导入一个 tar 包(.tar、.tar.gz、.tgz、.bzip、.tar.xz、.txz),并将其保存为文件系统镜像。

要求

在执行此模块的主机上需要以下要求。

  • 主机上已安装 Podman

参数

参数

注释

change

列表 / elements=dictionary

将更改设置为键值对的列表,请参阅示例。

commit_message

字符串

为导入的镜像设置提交消息

executable

字符串

如果 podman 可执行文件不在运行 podman 的机器上的 $PATH 中,则指定其路径

默认值: "podman"

src

字符串 / 必需

要加载的镜像文件的路径。

volume

字符串

要导入的卷,不能与 change 和 commit_message 一起使用

示例

# What modules does for example
- containers.podman.podman_import:
    src: /path/to/tar/file
    change:
      - "CMD": /bin/bash
      - "User": root
    commit_message: "Importing image"
- containers.podman.podman_import:
    src: /path/to/tar/file
    volume: myvolume

返回值

常见的返回值记录在这里,以下是此模块特有的字段

描述

image

字典

来自已加载镜像的信息

返回: 始终

示例: {"Annotations": {}, "Architecture": "amd64", "Author": "", "Comment": "从 tarball 导入", "Config": {}, "Created": "2021-09-07T04:45:38.749977105+03:00", "Digest": "sha256:8730c75be86a718929a658db4663d487e562d66762....", "GraphDriver": {"Data": {"UpperDir": "/home/...34/diff", "WorkDir": "/home/.../work"}, "Name": "overlay"}, "History": [{"comment": "从 tarball 导入", "created": "2021-09-07T04:45:38.749977105+03:00", "created_by": "/bin/sh -c #(nop) ADD file:091... in /"}], "Id": "cbc6d73c4d232db6e8441df96af81855f62c74157b5db80a1d5...", "Labels": null, "ManifestType": "application/vnd.oci.image.manifest.v1+json", "NamesHistory": null, "Os": "linux", "Parent": "", "RepoDigests": [], "RepoTags": [], "RootFS": {"Layers": ["sha256:...."], "Type": "layers"}, "Size": 5882449, "User": "", "Version": "", "VirtualSize": 5882449}

作者

  • Sagi Shnaidman (@sshnaidm)