gpt4 book ai didi

docker - 无法使用 ansible 和 community.general.docker_image 拉取 docker 镜像

转载 作者:行者123 更新时间:2023-12-04 02:27:59 34 4
gpt4 key购买 nike

在 ansible playbook 中,我正在尝试提取图像并重新标记它:

docker pull hyperledger/fabric-ccenv:amd64-1.4.4
docker tag hyperledger/fabric-ccenv:amd64-1.4.4 hyperledger/fabric-ccenv:latest

我什至无法成功地拉动它。

我用 community.general.docker_image 来做:

ansible-galaxy collection install community.general

然后是我的剧本:

---
- name: Pull an image
hosts: nodes
become: true
community.general.docker_image:
name: hyperledger/fabric-ccenv:amd64-1.4.4
source: pull

并运行:

ansible-playbook install-dependencies.yml

我收到这个错误:

ERROR! 'community.general.docker_image' is not a valid attribute for a Play

The error appears to be in 'install-dependencies.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- name: Pull an image
^ here

我做错了什么?

最佳答案

您的剧本中缺少任务选项:


- name: Pull an image
hosts: nodes
become: true
tasks:
- community.general.docker_image:
name: hyperledger/fabric-ccenv:amd64-1.4.4
source: pull

关于docker - 无法使用 ansible 和 community.general.docker_image 拉取 docker 镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66153370/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com