我正在尝试使用Ansible playbooks在AWS上配置我的基础架构.我有实例,并且能够提供docker-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,没有的问题.
谷歌搜索引导我不远,因为我似乎无法找到其他人有同样的错误.我想知道改变了什么,以及如何解决它!谢谢!
编辑:版本:
> ansible – 2.2.0.0
> docker – 1.12.3 6b644ec
> docker-py – 1.10.6
最佳答案
我有同样的问题.从1.9.0到1.8.1降低该主机上的docker-compose pip图像解决了这个问题.
原文链接:https://www.f2er.com/docker/435760.html- 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