I am trying to perform this bash command via Ansible on a remote host, leveraging Ansible modules:
docker pull example.com/some/path/to/image:sometag
Note, if I perform the above command on the device, it runs fine.
I know I can use shell
and call it a day, but tend to shy away from abstracting what is happening from Ansible.
I figured this was a common use-case, but all attempts to do something I thought would be fairly straight forward has only resulted in errors.
Some examples of what I have tried:
- name: Pull down file_ingest_agent
community.docker.docker_image_pull:
name: example.com/some/path/to/image:{{ file_ingest_agent }}
platform: amd64
This results in an error stating:
fatal: []: FAILED! => {“ansible_facts”: {“discovered_interpreter_python”: “/usr/bin/python3.8”}, “changed”: false, “msg”: “Error pulling image example.com/some/path/to/image:sometag – 500 Server Error for http+docker://localhost/v1.41/images/create?tag=sometag&fromImage=example.com%2Fsome%2Fpath%2Fto%2Fimage&platform=amd64: Internal Server Error (“unknown: repository some/path/to/image not found”)”}
It seems like it a 500 from localhost? Also, it seems to cut off the URL of the repository, stating that repository some/path/to/image
not found.
Also tried:
- name: run container
docker_image:
repository: example.com/some/path/to/image:{{ file_ingest_agent }}
name: image:{{ file_ingest_agent }}
source: pull
This results in an error stating:
fatal: []: FAILED! => {“ansible_facts”: {“discovered_interpreter_python”: “/usr/bin/python3.8”}, “changed”: false, “msg”: “Error pulling image image:sometag – 500 Server Error for http+docker://localhost/v1.41/images/create?tag=sometag&fromImage=image: Internal Server Error (“Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)”)”}
This seems to indicate it completely ignores the repository value and attempt to pull from http+docker://localhost/v1.41/images/create?tag=sometag&fromImage=image
I have tried a few variations of each of these, all with similar error results.
I would expect that the docker image from the private repo would be pulled down by the remote host the Ansible script is executing on.
ulatedym is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1