[英]Ansible how to push local image to private registry
I have a private registry on my server. 我的服务器上有一个私人注册表。
After which, I tried tag image and push it by ansible. 之后,我尝试标记图片并将其推送到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
Image dwf/test_sample
is local image on my laptop. 图像
dwf/test_sample
是笔记本电脑上的本地图像。 But it tries pull from DockerHub :|, and I received this error: 但是它尝试从DockerHub:|中拉出,并且我收到此错误:
"msg": "Error pulling dwf/test_sample - code: None message: Error: image dwf/test_sample not found"}
How to use local image or disable pull
when tag
and push
image ? 如何使用本地图像或在
tag
和push
图像时禁用pull
?
Pls suggest a specific solution. 请提出具体解决方案。 Thank you !
谢谢 !
The examples in the docs ( http://docs.ansible.com/ansible/docker_image_module.html ) give some guidance: docs( 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
For this to work you require the image test_sample
to be in your local docker instance. 为此,您需要将映像
test_sample
放在本地test_sample
实例中。
create a local image with the same repository and tag that will be in the 使用相同的存储库和标记创建本地映像
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.