gpt4 book ai didi

docker - 使用 Ansible 部署 Docker 镜像

转载 作者:行者123 更新时间:2023-12-04 00:15:03 27 4
gpt4 key购买 nike

在浏览了这个很棒的论坛后,我认为是时候加入...

我在部署多个 Docker 的剧本时遇到问题。

  • 我的 Ansible 版本是:2.5.1
  • 我的 Python 版本是 3.6.9
  • 我的 Linux 镜像是来自该网站的 18.04:OSboxes

Docker 服务已安装并在两台机器上运行。

根据本网站,您只需按照说明进行操作,一切都会完美运行。 :)

https://www.techrepublic.com/article/how-to-deploy-a-container-with-ansible/

(我使用的剧本在上面的链接中)

但在按照步骤操作并使用剧本后,我遇到了这个错误。

TASK [Pull default Docker image] ******************************************************************************************************
fatal: [192.168.1.38]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (docker_image) module: source Supported parameters include: api_version, archive_path, buildargs, cacert_path, cert_path, container_limits, debug, docker_host, dockerfile, filter_logger, force, http_timeout, key_path, load_path, name, nocache, path, pull, push, repository, rm, ssl_version, state, tag, timeout, tls, tls_hostname, tls_verify, use_tls"}

很高兴您在这个问题上提供支持。

最佳答案

source: pull 选项被添加到 Ansible 2.8 .由于您使用的是 Ansible 2.5.1,因此该选项不可用。

您可以使用更高版本,2.8 或更高版本,或者只是从您的剧本中删除该行,它应该可以工作:

- name: Pull default Docker image
docker_image:
name: "{{ default_container_image }}"

您无法保证图像是从注册表中新提取的。如果这对您来说很重要,您可以先删除任何本地缓存的图像版本:

- name: Remove Docker image
docker_image:
name: "{{ default_container_image }}"
state: absent

- name: Pull default Docker image
docker_image:
name: "{{ default_container_image }}"

关于docker - 使用 Ansible 部署 Docker 镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64694176/

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