To build container images from source code, connect your Container Registry Enterprise Edition instance to a source code repository. This topic covers how to bind Gitee, GitHub, GitLab, and Bitbucket.
This topic applies to Container Registry Enterprise Edition. To bind a source code repository to a Container Registry Personal Edition instance, see Bind a source code hosting platform.
Prerequisites
Before you begin, ensure that you have:
An account on the source code repository you want to bind
A Container Registry Enterprise Edition instance. For more information, see Create a Container Registry Enterprise Edition instance
Supported source code repositories
Container Registry Enterprise Edition supports the following source code repositories:
| Repository | Supported versions | Authentication | Limit on triggering image building |
|---|---|---|---|
| Gitee | All | Gitee OAuth authentication | None |
| GitHub | Developer version | GitHub OAuth authentication | None |
| GitLab | All | Personal access token | None |
| Bitbucket | All | Gitee OAuth authentication | None |
Gitee cannot be bound to Container Registry Personal Edition instances.
Bind to Gitee
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 Enterprise Edition instance that you want to manage.
In the left-side navigation pane, choose Repository > Code Source.
On the Code Source page, find Gitee and click Bind Account in the Actions column.
In the Gitee dialog box, click Go to the source code repository to bind account.
On the Gitee login page, enter your account and password, then click Log In.
On the Gitee Authorization page, verify the authorization information and click Permit. If Bind successfully is displayed in the Container Registry console, the instance is bound to Gitee.
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 Enterprise Edition instance that you want to manage.
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 login 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. If You have successfully bound the GitHub account is displayed in the Container Registry console, the instance is bound to GitHub.
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 Enterprise Edition instance that you want to manage.
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 login page, enter your email, account, and password, then click Sign In.
On the Bitbucket Authorization page, verify the authorization information and click Grant access.
In the Bind Account dialog box, set Instance Type, Region, and Instance, then click Confirm. If Bound is displayed in the Status column for Bitbucket on the Code Source page, the instance is bound to Bitbucket.
Bind to GitLab
For self-managed GitLab instances, note the following port requirements before binding:
HTTP: Port 80 is used by default. To use a different port, append the port number to the trigger URL. Supported ports: 80, 21, 443, 70, 210, 280, 488, 591, 777, and 1025–65535.
HTTPS: Only port 443 is supported. To use a different port, switch to HTTP.
GitLab cannot be accessed over a firewall or by using a self-signed SSL certificate. To bind a private GitLab repository in a VPC, see Build a container image in a VPC.
Step 1: Create a personal access token in GitLab
Log on to GitLab with the Admin account.
Click the 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 Name and Expires At, then click Create personal access token. The token is displayed on the Access Tokens page.

Step 2: Bind the instance in the Container Registry console
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 Enterprise Edition instance that you want to manage.
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, set the following parameters, then click Confirm. If Bound is displayed in the Status column for GitLab on the Code Source page, the instance is bound to GitLab.
Parameter Description URL The login URL of your GitLab instance. Enter the public GitLab URL or your private GitLab URL. Username The username you use to log on to GitLab. Private Token The personal access token you created in Step 1.
What's next
If you fail to bind a Container Registry Enterprise Edition instance to a source code hosting platform, see FAQ about source code repositories to troubleshoot the error.