Create container images
The Harbor App needs to be activated for this lab.
You can use the Container Images feature in App Platform to create container images from source with pre-configured Tekton pipelines using the paketo (used by Buildpacks mode) task or the Kaniko task (used by the Docker mode) to build images from application source.
Create the blue image
-
In the left menu, click on
Container Images
. -
Click on
CREATE CONTAINER IMAGE
. -
Select the
Docker
build task. -
Select the
blue
repository from the Repository drop-down list.
-
Select the Reference (branch or tag). The
blue
repo only has one branch (main
). -
Optionally you can change the Image name and tag. This is the name and tag used to store the image in the private Harbor image registry.
-
Click
Create Container Image
.
Now a Tekton Pipeline and PipelineRun resource to build the image will be created by the App Platform. This will take around 30 seconds. Then the PipelineRun will start building the image. During this time the status will show in progress
:
When the build is finished, the status will show ready
:
To see the full PipelineRun of the build, go to the list of Builds and click on PipelineRun
of the blue
build. This will open the Tekton Dashboard and show the status of the PipelineRun of the build:
When the build is ready you can see the image in Harbor:
-
Open Harbor.
-
Click on the project of your team. Here you will see all the registries of the team, including the registry of the new build image.
Manually re-run the build task (optional)
To re-build the image using the same tag, restart the build pipeline using the Tekton cli in the Shell:
-
Start a shell in the Console
-
Get the name of the pipeline
kubectl get pipelines
NAME AGE
docker-build-blue-main 41h
- Get the name of the pipelinerun:
kubectl get pipelineruns
NAME SUCCEEDED REASON STARTTIME COMPLETIONTIME
docker-build-blue-main True Succeeded 41h 41h
- Start the pipeline using the pipelinerun:
tkn pipeline start docker-build-blue-main --use-pipelinerun docker-build-blue-main
PipelineRun started: docker-build-blue-main-j5mmt
- In order to track the PipelineRun progress run:
tkn pipelinerun logs docker-build-blue-main-j5mmt -f
But it's easier to just open the Tekton dashboard and Click on PipelineRuns
.