5

I'm trying to provision my infrastructure on AWS using Ansible playbooks. I have the instance, and am able to provision docker-engine, docker-py, etc. and, I swear, yesterday this worked correctly and I haven't changed the code since.

The relevant portion of my playbook is:

- 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

My {{ docker_registry }} is set to my-acct-id.dkr.ecr.us-east-1.amazonaws.com and the result I'm getting is:

"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"

However, as mentioned, this worked correctly last night. Since then I've made some VPC/subnet changes, but I'm able to ssh to the instance, and run docker pull my-acct-id.dkr.ecr.us-east-1.amazonaws.com/example with no issues.

Googling has led me not very far as I can't seem to find other folks with the same error. I'm wondering what changed, and how I can fix it! Thanks!

EDIT: Versions:

  • ansible - 2.2.0.0
  • docker - 1.12.3 6b644ec
  • docker-py - 1.10.6
DTI-Matt
  • 2,065
  • 9
  • 35
  • 60
  • 1
    Having the exact same issue. It was working this morning for me and I haven't changed anything. I opened a bug: https://github.com/ansible/ansible-modules-core/issues/5775 – davegallant Nov 30 '16 at 19:36
  • I'm also seeing this when accessing both private and public Docker registries. It certainly is a head scratcher. – user1836542 Nov 30 '16 at 19:40

1 Answers1

4

I had the same problem. Downgrading docker-compose pip image on that host machine from 1.9.0 to 1.8.1 solved the problem.

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

Per this thread: https://github.com/ansible/ansible-modules-core/issues/5775, the real culprit is requests. This fixes it:

  - name: fix requests
    pip: name=requests version=2.12.1 state=forcereinstall
minun09
  • 81
  • 2
  • This worked for me. Strange, it look likes 1.9.0 was released a couple weeks ago. – davegallant Nov 30 '16 at 20:55
  • This worked for me too, though I think there is a large issue here we're missing and would advise to keep an eye on the GitHub issue davey_dev linked to above. – DTI-Matt Nov 30 '16 at 21:22