我正在尝试使用 Ansible 剧本在 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
。
谷歌搜索并没有让我走得很远,因为我似乎找不到其他有同样错误的人。我想知道发生了什么变化,以及如何解决它!谢谢!
编辑:版本:
- 可靠 - 2.2.0.0
- 码头工人 - 1.12.3 6b644ec
- 码头工人-py - 1.10.6