All Products
Search
Document Center

Access the public network

Last Updated: Aug 15, 2019

Access the public network

  1. Bind a NAT Gateway and EIP to the VPC
  2. Bind an EIP to the container group

Bind a NAT Gateway and EIP to the VPC

Use case 1 Pull images from Docker Hub

Make sure that there is a VSwitch available in the VPC you selected. The following figure shows that there is no VSwitch available. You need to create a VSwitch. Make sure that the VSwitch is in the same region and zone as the VPC.

dcoker-network

After the VSwitch is created, you need to create a NAT Gateway instance in the VPC, as shown in the following figure:

Note: Only one NAT Gateway instance can be bound to a VPC.

docker-network

As the following figure shows, a newly created NAT Gateway instance has no EIP, which is necessary for accessing the Docker Hub.

docker-network

To bind an EIP to the NAT Gateway gateway, click Set SNAT, as shown in the figure:

Note: An EIP must be requested beforehand.

docker-network

Now, the container group is ready to pull images from Docker Hub when it is created.

If you do not follow the preceding steps, the container group will fail to pull the images, as shown in the figure:

docker-network

Bind an EIP to the container group

Use case 2 Enable NGINX to access the public network

Select an EIP from the Elastic IP Address drop-down box. By default, NGINX uses port 80 to listen to traffic sent though this EIP. Therefore, you need to configure a security group rule to allow traffic to port 80.

nginx-network

nginx-network

nginx-network

The following figure shows the result of a request to the EIP at the correct port if settings are appropriately configured.

nginx-network