We will add the UNPACK_ROOTFS parameter to the task. This parameter tells
the oci-build-task to include the image in a special format that
Concourse's container runtime uses.
Note
In the future this may not be necessary if Concourse starts using the OCI image format.
---resources:# The repo with our Dockerfile-name:concourse-examplestype:giticon:githubsource:uri:https://github.com/concourse/examples.gitbranch:mainjobs:-name:build-and-use-imageplan:-get:concourse-examples-task:build-task-imageprivileged:trueconfig:platform:linuximage_resource:type:registry-imagesource:# Check out the README for oci-build-task at# https://github.com/concourse/oci-build-taskrepository:concourse/oci-build-taskinputs:-name:concourse-examplesoutputs:-name:imageparams:CONTEXT:concourse-examples/Dockerfiles/simpleUNPACK_ROOTFS:"true"# only needed if using image in a future steprun:path:build
The above pipeline will build a container image and also output it in Concourse's rootfs image format.
Use the Image
Next we want to add a second task to this job which will use the image generated from the first task as its container
image. To use the image from the previous step add the top-level image key to the task step.
resources:...# omitting resource section from abovejobs:-name:build-and-use-imageplan:-get:concourse-examples-task:build-task-imageprivileged:trueconfig:platform:linuximage_resource:type:registry-imagesource:# Check out the README for oci-build-task at# https://github.com/concourse/oci-build-taskrepository:concourse/oci-build-taskinputs:-name:concourse-examplesoutputs:-name:imageparams:CONTEXT:concourse-examples/Dockerfiles/simpleUNPACK_ROOTFS:"true"# only needed if using image in a future steprun:path:build-task:use-built-image-in-taskimage:imageconfig:platform:linuxrun:path:catargs:["/stranger"]
You can set the pipeline with the following fly command.