edit-icon download-icon

Build a repository

Last Updated: Jan 26, 2018

Overview

In full compliance with the open-source container technology standards, Alibaba Cloud Container Registry provides the ability of building images based on Dockerfiles. This service eases the entire process from code repository to container application deployment, allowing you to containerize your services quickly and efficiently.

Features

  • Container Repository supports automatically triggering the build when the code changes.

    If Automatically create an image when the code changes is selected in Build Settings, the image can be automatically built after you submit the code, without requiring you to manually trigger the build.

  • Container Repository supports overseas build.

    You might depend on overseas sources when building your code. However, considering the network environment, Container Repository supports building an image on an overseas machine. Then, the image built on an overseas machine is pushed back to the repository in the specified region.

    autobuild

  • Container Repository supports multi-stage build.

    Alibaba Cloud Container Repository also supports the latest multi-stage build characteristics.

Set build rules

  1. Log on to the Container Registry console.
  2. Click Create repo in the upper-right corner.

    4

  3. Set the build rules.

    5

    • Automatically create an image when the code changes: With this check box selected, the build rule is automatically triggered when code is submitted from a branch.
    • Create on an Overseas Machine: With this check box selected, the image is built on an overseas machine and then pushed back to the repository in the specified region.

      Note: Sometimes the network between China Mainland and abroad is not stable, the image might fail to be pushed back because of timeout.

    • Do Not Use the Cache: With this check box selected, the dependent base image is pulled again each time an image is built, which might slow down the build time.
    • Select branch or tag: Set the code branch for the build.
    • Dockerfile directory: Set the directory where the Dockerfile is located.

      Note: The directory here refers to a relative directory, which uses the root directory of the code branch as the parent directory.

    • Dockerfile name: Set a name for the Dockerfile. The default name is Dockerfile.
    • Image version: Set an image tag, such as latest.
  4. Click Create repo in the lower right corner to create the image repository.

Modify build rules

  1. Log on to the Container Registry console.

  2. Click Manage at the right of an image repository to enter the repository details page.

  3. Click Build in the left-side navigation pane to enter the image build details page.

    7

  4. Click Modify Settings on the right to modify the build rules.

    8

  5. Modify and set the build rules.

    9

    • Automatically create an image when the code changes: With this check box selected, the build rule is automatically triggered when code is submitted from a branch.
    • Create on an Overseas Machine: With this check box selected, the image is built on an overseas machine and then pushed back to the repository in the specified region.

      Note: Sometimes the network between China Mainland and abroad is not stable, the image might fail to be pushed back because of timeout.

    • Do Not Use the Cache: With this check box selected, the dependent base image is pulled again each time an image is built, which might slow down the build time.
    • Add a Build Rule: Create a build rule.
    • : Delete this build rule.
  6. Click OK to finish the modification.

Build an image

  1. Log on to the Container Registry console.

  2. Select the region.

  3. Click Manage at the right of an image repository to enter the repository details page.

  4. Click Build in the left-side navigation pane.

  5. Click Build Now in the upper right corner to build an image based on the build rules you set.

    10

    A new build record is generated after you click Build Now.

    11

  6. Click Log at the right of the build record to view the build logs.

    12

  7. After the image is built, click Image Versions in the left-side navigation pane to view the list of built images.

    13

  8. View the list of all the image versions.

    14

Thank you! We've received your feedback.