Create an application from a private image repository
Last Updated: Jan 21, 2021
In many scenarios, you use an image in a private image repository to deploy an application.
This topic describes how to create a private image repository in the Container Registry
console and use an image in this repository to create an application.
Create a private image repository
If this is the first time you use the Container Registry console, the Tips message appears, prompting you to set a password for logging on to the console. Click
Activate Now and set a password.
In the left-side navigation pane, choose Marketplace > Alibaba Cloud Container Registry.
In the left-side navigation pane of the Container Registry console, choose Default Instance > Repositories. In the top menu bar, select a region to deploy the repository and click Create Repository.
In the Create Repository dialog box, set the Namespace, Repository Name, Summary, and Repository Type parameters. In this example, the type of the repository is private. Click Next.
On the Code Source wizard page, set Code Source to Local Repository and click Create Repository.
On the Repositories page, select the region and namespace where the repository is
created, find the created repository, and click Manage in the Actions column.
On the Details page of the repository, click the Guide tab and view details about how to use the private image repository.
Log on to the repository from a Linux server and run the following command to upload
a local image to the repository:
sudo docker login --username=abc@aliyun.com registry.cn-hangzhou.aliyuncs.com
Password: ## The password that is used to log on to the repository.
Login Succeeded
docker images
# Tomcat is used as an example.
REPOSITORY TAG IMAGE ID CREATED SIZE
tomcat latest 2d43521f2b1a 6 days ago 463MB
sudo docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/the name of the namespace/tomcat-private:[image version]
sudo docker push registry.cn-hangzhou.aliyuncs.com/the name of the namespace/tomcat-private:[image version]
After the private image is created, the system prints the following output:
Go to the Details page of the repository. In the left-side navigation pane, choose
Tags and verify that the local image is uploaded to the repository. You can also view
the image version.
Create a private repository Secret
To pull private images, you must use a private repository Secret.
On the Clusters page, find the cluster that you want to manage and click Details in the Actions column.
In the left-side navigation pane, click Configurations.
On the Configurations page, click the Secrets tab.
In the upper-right corner of the Secrets tab, click Create.
In the Create panel, set the parameters and click OK.
Parameter
Description
Name
The name of the Secret.
Type
The following types of Secret are supported:
Opaque: a general Secret. Enter a key and a value. The value must be encoded in Base64.
Private Repository Logon Secret: the credentials that are required to pull images
from a private image repository. Enter the address, username, and password of the
repository.
Note The username is the full name of your Alibaba Cloud account. The password is the one
that is specified to log on to the Container Registry console. You can go to the Access Credential page to change the password.
TLS Certificate: Transport Layer Security (TLS) certificates are used to verify user
identities.
Cert: Enter the content of the TLS certificate.
Key: Enter the private key of the TLS certificate.
After the Secret is created, you are redirected to the Secrets page. You can find
the newly created Secret in the list.