问题
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