How to use a local docker image as resource in concourse-docker

孤街浪徒 提交于 2020-05-15 08:08:46

问题


I try to run a task in a docker image, which is not uploaded to docker hub, but instead installed locally (using docker build -t tagname/tagname .) So it exists on the (only) worker.

image_resource:
  type: docker-image
  source: {repository: tagname/tagname}

However, that approach fails with the following error:

Is there an easy way to have concourse run a docker image without having to push it to docker hub nor to set up a local repository?


回答1:


This is possible with the rootfs_uri task parameter.

You will have to find out where exactly in the worker filesystem the rootfs created by docker build is stored, and then reference it in the task with rootfs_uri: file://<your_rootfs>.

As the documentation says this is not recommended as you are not taking advantage of any of the concourse image caching logic.




回答2:


From @Josh Zarrabi's answer, which I accept for its correctness I learned, not to do it. So the correct approach is to set up your own docker registry, which is very simple using the https://hub.docker.com/_/registry/ container.



来源:https://stackoverflow.com/questions/52499026/how-to-use-a-local-docker-image-as-resource-in-concourse-docker

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!