To automatically build container images when code is pushed to your repository, bind your Container Registry Personal Edition instance to a source code hosting platform. Once bound, you can perform operations such as image building.
Prerequisites
Before you begin, make sure that you have:
-
An account on the source code hosting platform you want to bind
-
A Container Registry Personal Edition instance. For more information, see Create a Container Registry Personal Edition instance
Supported platforms
Container Registry Personal Edition supports the following source code hosting platforms.
| Platform | Supported version | Authentication method | Limit on triggering image building |
|---|---|---|---|
| GitHub | GitHub developer version | GitHub OAuth authentication | None |
| Bitbucket | All | Bitbucket OAuth authorization | None |
| GitLab | All regions | Personal access token | None |
Bind to GitHub
-
Log on to the Container Registry console.
-
In the top navigation bar, select a region.
-
In the left-side navigation pane, click Instances.
-
On the Instances page, click the Personal Edition instance you want to bind.
-
In the left-side navigation pane, choose Repository > Code Source.
-
On the Code Source page, find GitHub and click Bind Account in the Actions column.
-
In the GitHub dialog box, click Go to the source code repository to bind account.
-
On the GitHub logon page, enter your account and password, then click Sign in.
-
On the Authorize Aliyun Container Registry page, verify the authorization information and click Authorize AliyunDeveloper.
After returning to the Container Registry console, the message You have successfully bound the GitHub account confirms the binding is complete. You can now set up image build rules for your GitHub repositories.
Bind to Bitbucket
-
Log on to the Container Registry console.
-
In the top navigation bar, select a region.
-
In the left-side navigation pane, click Instances.
-
On the Instances page, click the Personal Edition instance you want to bind.
-
In the left-side navigation pane, choose Repository > Code Source.
-
On the Code Source page, find Bitbucket and click Bind Account in the Actions column.
-
In the Bitbucket dialog box, click Go to the source code repository to bind account.
-
On the Bitbucket logon page, enter your email address, click Continue, enter your password, then click Sign in.
-
On the Confirm access to your account page, confirm the permissions and click Grant access.
After returning to the Container Registry console, the message You have successfully bound the Bitbucket account confirms the binding is complete. You can now set up image build rules for your Bitbucket repositories.
Bind to GitLab
Binding to GitLab requires two phases: first create a personal access token in GitLab, then configure the binding in Container Registry.
Constraints
Port requirements for self-managed GitLab
| Protocol | Default port | Supported ports |
|---|---|---|
| HTTP | 80 | 80, 21, 443, 70, 210, 280, 488, 591, 777, and 1025–65535 |
| HTTPS | 443 | 443 only. To use a different port, switch to HTTP. |
-
GitLab must be accessible over the Internet. Accessing GitLab through a firewall or with a self-signed HTTPS certificate is not supported.
-
If the instance is bound to a GitLab repository in a GitLab subgroup, image building can only be triggered manually.
Phase 1: Create a personal access token in GitLab
-
Log on to GitLab.
-
Click your profile picture, then click Settings.
-
In the left-side navigation pane of the User Settings page, click Access Tokens.
-
On the Access Tokens page, set the Name and Expires At fields, select the api scope, and click Create Personal Access Token. You can view the generated access token on the Access Tokens page.

Phase 2: Bind the instance in Container Registry
-
Log on to the Container Registry console.
-
In the top navigation bar, select a region.
-
In the left-side navigation pane, click Instances.
-
On the Instances page, click the Personal Edition instance you want to bind.
-
In the left-side navigation pane, choose Repository > Code Source.
-
On the Code Source page, find GitLab and click Bind Account in the Actions column.
-
In the Private GitLab dialog box, configure the following parameters and click Confirm. When Bound appears in the Status column on the Code Source page, the instance is bound to GitLab. You can now set up image build rules for your GitLab repositories.
Parameter Description Example URL The logon URL of your GitLab instance. For the public GitLab service, enter https://gitlab.com. For a self-managed GitLab, enter its deployment address.https://gitlab.comUsername The username you use to log on to GitLab. alicePrivate Token The personal access token you created in Phase 1. glpat-xxxxxxxxxxxx
What's next
-
Set up build rules to automatically trigger image builds when code is pushed to your repository
-
If the binding fails, see FAQ about source code repositories to troubleshoot