Ansible docker_container'否请求URL中的主机',docker pull正常工作

我正在尝试使用Ansible操作手册在AWS上configuration我的基础架构。 我有这个实例,并且能够configurationdocker-engine,docker-py等,我发誓,昨天这个工作正常,而且我从来没有改变过代码。

我的剧本的相关部分是:

- name: Ensure AWS CLI is available pip: name: awscli state: present when: aws_deploy - block: - name: Add .boto file with AWS credentials. copy: content: "{{ boto_file }}" dest: ~/.boto when: aws_deploy - name: Log in to docker registry. shell: "$(aws ecr get-login --region us-east-1)" when: aws_deploy - name: Remove .boto file with AWS credentials. file: path: ~/.boto state: absent when: aws_deploy - name: Create docker network docker_network: name: my-net - name: Start Container docker_container: name: example image: "{{ docker_registry }}/example" pull: true restart: true network_mode: host volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone 

我的{{ docker_registry }}被设置为my-acct-id.dkr.ecr.us-east-1.amazonaws.com ,我得到的结果是:

 "msg": "Error pulling my-acct-id.dkr.ecr.us-east-1.amazonaws.com/example - code: None message: Get http://: http: no Host in request URL" 

不过,如前所述,昨天晚上这个工作正常。 从那时起,我做了一些VPC /子网更改,但我可以ssh到实例,然后运行docker pull my-acct-id.dkr.ecr.us-east-1.amazonaws.com/example的问题。

谷歌search导致我不是很远,因为我似乎无法find同样的错误其他人。 我想知道是什么改变了,我该如何修复它! 谢谢!

编辑:版本:

  • ansible – 2.2.0.0
  • docker工人 – 1.12.3 6b644ec
  • docker-py – 1.10.6

我有同样的问题。 在这台主机上将docker-compose pip图像从1.9.0降级到1.8.1解决了这个问题。

 - name: Install docker-compose pip: name=docker-compose version=1.8.1 

根据这个线程: https : //github.com/ansible/ansible-modules-core/issues/5775 ,真正的罪魁祸首是请求。 这解决了它:

  - name: fix requests pip: name=requests version=2.12.1 state=forcereinstall