python – msg:ConnectionError(ProtocolError(‘Connection aborted.’,error(2,’No such file or director

我在TASK上遇到错误Nginx容器:

Failed: [localhost] => {"changed": false, "Failed": true}
msg: ConnectionError(ProtocolError('Connection aborted.', error(2, 'No such file or directory')),)

FATAL: all hosts have already Failed -- aborting

播放下一个Ansible剧本时:

---
-   name: Play
    hosts: localhost
    vars: []
    tasks:
        -   name: Nginx container
            docker:
                name: my.Nginx2
                image: Nginx
                state: started

我做错了什么?这是一个错误吗?

附:使用-vvvv得到的更详细的输出是:

<localhost> REMOTE_MODULE docker state=started name=my.Nginx2 image=Nginx
<localhost> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1431434101.65-11072088770561 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1431434101.65-11072088770561 && echo $HOME/.ansible/tmp/ansible-tmp-1431434101.65-11072088770561']
<localhost> PUT /tmp/tmp7ySlXq TO /home/victor/.ansible/tmp/ansible-tmp-1431434101.65-11072088770561/docker
<localhost> EXEC ['/bin/sh', '-c', u'LANG=C LC_CTYPE=C /usr/bin/python /home/victor/.ansible/tmp/ansible-tmp-1431434101.65-11072088770561/docker']
Failed: [localhost] => {"changed": false, "Failed": true}
msg: ConnectionError(ProtocolError('Connection aborted.', error(2, 'No such file or directory')),)

FATAL: all hosts have already Failed -- aborting

解决方法:

你应该安装docker:

- name: install docker
  shell: curl -sSL https://get.docker.com/ | sh
  args:
     creates: /usr/bin/docker

你应该检查它是否有效:

- name: Wait for the Docker server to start
  action: raw docker version
  register: docker_version
  until: docker_version.stdout.find("Client") != -1
  retries: 30
  delay: 10

并且您需要满足所有依赖项(http://docs.ansible.com/ansible/docker_module.html):

Requirements (on host that executes module)
python >= 2.6
docker-py >= 0.3.0
The docker server >= 0.10.0

相关文章

Nginx (engine x) 是一个高性能的HTTP和反向代理服务,也是一...
本地项目配置 1 复制 luffy/settings/dev.py为prop.py 修改l...
nginx不仅可以隐藏版本信息,还支持自定义web服务器信息 先看...
一 、此次漏洞分析 1 nginx HTTP/2漏洞 [nginx-announce] ng...
###进入nginx 目录cd /usr/local/nginx###递归显示 2 级目录...
在cmd命令窗口输入下面命令进行查看 tasklist /fi "ima...