ansible docker_image无效的引用格式

ctehm74n  于 2023-01-29  发布在  Docker
关注(0)|答案(1)|浏览(179)

我需要从组变量值和下载一些图像从dockerhub,但价值投入不正确。
我的行动手册:

hosts: all

tasks:
  name: download image
  docker_image:
  name: 
   - "{{image}}"
  source: pull

我的组_vars

image:
  nginx
  ubuntu

和错误消息:

fatal: [linux1]: FAILED! => {"changed": false, "msg": "Error pulling image ['((image))']:latest - 400 Client Error for http+docker://localhost/v1.41/images/create?tag=latest&fromImage=%5B%27%28%28image%29%29%27%5D: Bad Request (\"invalid reference format\")"}

我尝试了不同的语法变体并更新了应用程序

owfi6suc

owfi6suc1#

docker_image模块的name参数应该是字符串,而不是列表:

- hosts: all
  tasks:
    - name: download image
      docker_image:
        name: "{{image}}"
        source: pull

相关问题