Create container images

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.

Prerequisites

  • The Harbor app needs to be activated.

Create the blue image

  1. In the left menu, navigate to Container Images.

  2. Click the Create Container Image button.

  3. Select Docker as the build task.

  4. Select the blue repository from the Repository drop-down list.

    kubecfg

  5. Select the Reference (branch or tag). The blue repo only has one branch (main).

  6. 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.

  7. Click Create Container Image. A Tekton Pipeline and PipelineRun resource (to build the image) are 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 an in progress status.

    build status

    When the build is finished, the status will be ready.

    build status

    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:

    build status

View image in Harbor

When the build is ready you can see the image in Harbor.

  1. Open Harbor.

  2. 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.

    build status

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:

  1. Start a shell in the App Platform Console

  2. Get the name of the pipeline

    kubectl get pipelines
    NAME                         AGE
    docker-build-blue-main       41h
    
  3. Get the name of the pipelinerun:

    kubectl get pipelineruns
    NAME                       SUCCEEDED   REASON      STARTTIME   COMPLETIONTIME
    docker-build-blue-main     True        Succeeded   41h         41h
    
  4. 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
    
  5. To track the PipelineRun progress, you can run the following command in your terminal. That said, it's often easier to open the Tekton dashboard and navigate to PipelineRuns,

    tkn pipelinerun logs docker-build-blue-main-j5mmt -f