Ansible docker_container "no host in request url", dockers work correctly

I am trying to provide my infrastructure on AWS using Ansible playbooks. I have an instance, and I can provide a docker engine, docker-py, etc., And I swear it worked correctly yesterday, and since then I have not changed the code.

Relevant part of my play:

- 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 }} set to my-acct-id.dkr.ecr.us-east-1.amazonaws.com , and the result I get is the following:

 "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 already mentioned, this worked fine last night. Since then, I have made some changes to the VPC / subnet, but I can pass ssh to the instance and run docker pull my-acct-id.dkr.ecr.us-east-1.amazonaws.com/example without problems.

Googling did not lead me very far, because I cannot find other people with the same mistake. I wonder what has 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
+5
source share
1 answer

I had the same problem. Lowering the docker-peak layout on this host computer from 1.9.0 to 1.8.1 solved the problem.

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

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

  - name: fix requests pip: name=requests version=2.12.1 state=forcereinstall 
+3
source

Source: https://habr.com/ru/post/1260603/


All Articles