You can use the P2P acceleration feature on hosts where Docker is installed to accelerate
image pulling and application deployment. This topic describes how to use the P2P
acceleration feature on hosts where Docker is installed.
Procedure
- View the ID of the Container Registry Enterprise Edition instance.
- 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 Container Registry Enterprise Edition instance whose ID you want
to view.
On the Overview page, view the ID of the Container Registry Enterprise Edition instance in the Instance section.
- Log on to the Elastic Compute Service (ECS) instance. For more information, see Connect to a Linux instance by using an SSH key pair.
- Run the following command to download the installation package of the P2P component:
docker run --rm -v /var/lib/aliyun-acr/p2p:/var/lib/aliyun-acr/p2p registry.cn-hangzhou.aliyuncs.com/acr-toolkit/p2p-installer-manual:v1.0.6-b6b9f5f9-aliyun
- Configure the P2P component.
/var/lib/aliyun-acr/p2p/scripts/01-init.sh --ak <aliyun-ak> --sk <aliyun-sk> --port 65001 --instance <acr-ee-instance-id>
Replace the AccessKey ID, AccessKey secret, ID of the Container Registry Enterprise
Edition instance, and the port used by the P2P component in the preceding command
as required. By default, the P2P component uses port 65001.
Note The AccessKey ID and AccessKey secret are used only to obtain the information about
the Container Registry Enterprise Edition instance during configuration initialization.
After the P2P component is configured, the /var/lib/aliyun-acr/p2p directory is generated.
- Run the following command to start the P2P component.
Note To install the P2P component on mulitple ECS instances, copy the directory that was
generated in Step
4 to these ECS instances. Then, run the command to start the P2P component on these
ECS instances.
/var/lib/aliyun-acr/p2p/scripts/02-run.sh
- Run the following command to log on to an image repository by using the P2P-accelerated
domain name:
docker login <P2P-accelerated domain name of the Container Registry Enterprise Edition instance>
The P2P-accelerated domain name is in the following format: <Name of the Container
Registry Enterprise Edition instance>>-registry-vpc.distributed.<Region where the
Container Registry Enterprise Edition instance resides>.cr.aliyuncs.com:<Port used
by the P2P component>.
- Run the following command to pull an image by using the P2P-accelerated domain name:
docker pull <P2P-accelerated domain name of the Container Registry Enterprise Edition instance>/test/busybox:latest
- Optional:Run the following command to uninstall the P2P component:
/var/lib/aliyun-acr/p2p/scripts/03-uninstall.sh