我的服务器上有一个私人注册表。
之后,我尝试了标记图像并通过ansible推送它。
- name: Tag to repository to a private registry and push it
docker_image:
name: dwf/test_sample
repository: registry.dwf.com/dwf/test_sample
state: present
图片dwf/test_sample
是我笔记本电脑上的本地图片。但它尝试从DockerHub拉取:|,我收到了这个错误:
"msg": "Error pulling dwf/test_sample - code: None message: Error: image dwf/test_sample not found"}
如何使用本地图片或在pull
和tag
图片时停用push
?
请建议一个具体的解决方案。谢谢!
答案 0 :(得分:0)
文档中的示例(http://docs.ansible.com/ansible/docker_image_module.html)提供了一些指导:
- name: Push image to registry
docker_image:
name: test_sample
repository: registry.dwf.com:5000/test_sample
push: yes
为此,您需要将图像test_sample
放在本地泊坞窗实例中。
答案 1 :(得分:0)
使用与
中相同的存储库和标记创建本地图像remote registry
- name: "tag the image"
docker_image:
name: "local-image:tagname"
repository: "reponame:tagname"
- name: "push to docker registry"
docker_image:
name: "reponame:tagname"
push: yes