- Bind a NAT Gateway and EIP to the VPC
- Bind an EIP to the container group
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.
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.
As the following figure shows, a newly created NAT Gateway instance has no EIP, which is necessary for accessing the Docker Hub.
To bind an EIP to the NAT Gateway gateway, click Set SNAT, as shown in the figure:
Note: An EIP must be requested beforehand.
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:
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.
The following figure shows the result of a request to the EIP at the correct port if settings are appropriately configured.