Access containers by domain name
To access a Container Service instance with a domain name, you must bind the domain name to the instance and resolve it to the instance's public endpoint. This topic describes this process.
Prerequisites
-
The Container Service instance must be publicly accessible, and a container must be configured to respond to public access requests. For more information, see Deploy a container.
-
You have registered a domain name with a domain registrar or with Alibaba Cloud. For more information about how to register a domain name on Alibaba Cloud, see Register a domain name.
Procedure
-
Go to the Simple Container Service page in the Simple Application Server console.
-
On the Container Service page, click the ID of the target Container Service instance.
If you have a large number of Container Service instances, you can enter an instance ID in the search box to filter the list.
-
Add a domain name.
-
Click the Domain Binding tab and then click Add Zone.
-
In the Add Zone dialog box, enter your domain name and then click OK.
-
After binding the domain name, record the value of the resolution target.
In the domain name list, you can view and copy the CNAME value from the Resolution Target column.
-
-
Resolve the domain name.
After binding the domain name, you must configure its DNS resolution. The required steps vary depending on where your domain name is registered.
Domains on Alibaba Cloud
-
Log on to the Alibaba Cloud DNS console.
-
On the domain name resolution page, click the Authoritative Zone tab, click Add Zone, enter your domain name as prompted, and then click OK.
-
Click the domain name. On the Settings tab, click Add Record.
In the Add Record panel, configure the record with the settings in the following table.
Parameter
Description
Record Type
Select CNAME.
Hostname
Enter the prefix of the domain name.
-
To resolve www.example.com, set the host record to
www. -
To resolve example.com, set the host record to
@.
Record Value
Enter the resolution target value for the Container Service instance. For example: cs-7d9ea542e076462586db93cbe664****.simple-server.cn.
To obtain the resolution target value, see Recording the resolution target value.
TTL
Time to Live (TTL) specifies how long DNS servers cache the record. A lower value allows DNS changes to take effect faster. The default value is 10 minutes.
-
-
Click OK.
Domains on other providers
If your domain name is registered with another provider, see How do I configure DNS records in Alibaba Cloud DNS for a domain name not registered on Alibaba Cloud?
ImportantWhen you add the record, set the Record Type to CNAME. For parameter descriptions, see the parameter description table.
-
-
In a web browser, enter the domain name to access the container.
If you are using an Nginx container, a welcome page is displayed upon successful access.
This page has the Welcome to nginx! heading and confirms that Nginx is running and the domain is correctly configured.