简体   繁体   English

Ansible如何将本地映像推送到私有注册表

[英]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 ? 如何使用本地图像或在tagpush图像时禁用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.

相关问题 无法在本地私有注册表上推送 docker 镜像 - Unable to push docker image on local private registry 如何将私有 docker 镜像推送到本地 gitlab 服务器中的 gitlab 容器注册表 - How to push a private docker image to gitlab container registry in a local gitlab server 如何配置Jenkinsfile来构建docker映像并将其推送到私有注册表 - How to configure a Jenkinsfile to build docker image and push it to a private registry 如何将映像从私有注册表推送到hub.docker.com? - How to push image from private registry to hub.docker.com? 无法将映像推送到私有 docker 注册表 - Not able to push image to private docker registry Docker 无法将镜像推送到私有镜像仓库 - Docker cannot push image to private registry Docker - 无法将图像推送到私有注册表 - Docker - Unable to push image to private registry 如何从一个私有注册表中提取 Docker 映像并将其推送到 Jenkins 管道中的第二个不同的私有注册表 - How do I pull a Docker image from one private registry and push it to a second different private registry in Jenkins pipeline 私有注册表和本地映像注册表之间的docker区别? - docker difference between private registry and the local image registry? 如何将 tar 存档推送到私有 docker 注册表? - How to push a tar archive to private docker registry?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM