dockergitlab-cidevopspipelinebuildah

In Gitlab CI how to pass a docker image between jobs, without pushing to registry?


I want to build image in job1, and save it as artifact for other jobs. This will eliminate the need of building the image in every job.

However I am not sure how can I achieve passing the image between the jobs, as I am not allowed to push the image to any registry. Is it possible?


Solution

  • As you said you'd like to "save it as artifact for other jobs" I think you can make use of job artifacts in combination with the docker save and docker load commands.

    Those Docker command will allow you to work with images as files (tar archives). The file you'll obtain will be usable as a job artifact at the end of some job, making it reusable for the next ones.


    On a side note, any GitLab repository comes with a Docker registry that you should be able to use. There is a documentation page if you need authentication during CI.