Upload an image to a Gold Zone image repository

更新时间:
复制 MD 格式

For security reasons, Gold Zone image repositories cannot be accessed from the public network. To upload an image, you must use an Elastic Compute Service (ECS) server that is in the same Virtual Private Cloud (VPC). This topic describes how to upload an image from an ECS server to a Gold Zone image repository.

Prerequisites

  • The image building process is complete.

  • You have created a Gold Zone image repository.

  • You have installed Docker.

    Note

    You must install Docker locally to run commands that package the image into a compressed file. For installation instructions, see the official Docker website.

Procedure

  1. Package the local image into a compressed file.

    1. On your local machine, run the following command to view information about your local images:

      sudo docker images

      The following output is an example of the returned image information:

      sudo docker images
      REPOSITORY                        TAG             IMAGE ID      CREATED    VIRTUAL SIZE
      registry.aliyuncs.com/acs/agent   0.7-dfb6816   37bb9c******    7 days ago    37.89 MB
    2. Package the local image into a compressed file.

      sudo docker save -o [package_name] [REPOSITORY]:[TAG]

      The following are examples of variable values:

      Variable name

      Description

      Example value

      [package_name]

      The name of the compressed package.

      sofaboot_demo.tar.gz

      [REPOSITORY]

      The repository address.

      registry.aliyuncs.com/acs/agent

      [TAG]

      The version number.

      1.0.0

  2. Upload the compressed package to the ECS server.

    On your local machine, run the following command to upload the compressed package to the ECS server:

    sudo scp [package_name] root@[ECS_public_IP]:[path_on_ECS_server]

    Examples of variable values include the following:

    Variable

    Example value

    [path_on_ECS_server]

    /home/images/

    [package_name]

    sofaboot_demo.tar.gz

    [ECS_public_IP]

    121.41.***.***

  3. Upload the image to the image repository.

    1. Log on to the Container Application Service console. In the navigation pane on the left, click Cluster Management > Cluster Details.

    2. On the Cluster Details page, click the Nodes tab.

    3. Find the target node and click Remote Connection in the Actions column.

      Important

      The ECS server must be assigned an elastic IP address (EIP). For more information, see Apply for a new EIP.

    4. Enter the VNC password.

      Note

      If you forget the VNC password, you can click Modify VNC Password to reset it.

    5. Enter the ECS server password.

    6. Run the following commands to upload the image to the image repository:

      sudo cd [path_on_ECS_server]
      sudo docker load -i [package_name]
      sudo docker login --username=[logon_account] [Registry]
      sudo docker tag [ImageId] [repository_address]:[image_version_number]
      sudo docker push [repository_address]:[image_version_number]

      The following are example variable values:

      Variable

      Example value

      [path_on_ECS_server]

      /home/images/

      [package_name]

      sofaboot_demo.tar.gz

      [logon_account]

      aksinpsecttest@1639881487******

      [Registry]

      registry-vpc.cn-hangzhou-finance.aliyuncs.com

      [ImageId]

      798f63******

      [repository_address]

      registry-vpc.cn-hangzhou-finance.aliyuncs.com/sofaboot-space/sofaboot_store

      [image_version_number]

      1.0.0