Sometimes you may want to build a Docker image in one job, and use it in another job. The following steps can be used with smaller images to achieve that.
- Build the Docker image
- Save the image to a tar file
docker save -o <file path for generated tar file> <image name>
- Persist the image file to a workspace.
- Attache to the workflow workspace
- Load the Docker image from the workspace
docker load -i <path to image tar file>
- Enjoy - your image is available
Note: If your images are large (>~1GB) this will probably not be a great solution. You can try gzipping the images as well or consider strategies to reduce your image sizes