• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. User Guide 2.0
  4. Data Migration from an Earlier Version to the Latest Version
  5. Migrating an Image

Migrating an Image

Images uploaded to the earlier CCE version need to be migrated to the latest CCE version.

The following is an example of migrating the apache image to the latest CCE version.

Figure 1 Image in the earlier CCE version

Procedure

  1. Before you upload container images, ensure that your local Docker client can access the private container registry. For details, see Connecting to the Private Container Registry.
  2. Create an organization. An organization is used to isolate images and assign access permissions (read, edit, and manage) to different users.

    1. Log in to the CCE console. In the navigation pane, choose Image Repository. Click Create Organization.
    2. Enter an organization name, which is the domain_name of the account, that is, Figure 1. Then, click OK.

  3. Create an image repository. An image repository is used to store, deploy, and manage Docker images.

    1. Log in to the CCE console. In the navigation pane, choose Image Repository. Click Create Repository.
    2. Configure the parameters for creating an image repository, as listed in Table 1. The parameters marked with an asterisk (*) are mandatory.
      Table 1 Parameters for creating an image repository

      Parameter

      Description

      * Repository Name

      1. Select the organization created in 2.
      2. Enter the image name shown in the earlier version, for example, apache-php in Figure 1.

      * Sharing Type

      Container image repository type.

      • Public: available to all tenants and users.
      • Private: available only to the current tenant and associated users.

      * Category

      Select a repository category.

      Description

      Brief description of the image repository.

    3. Click Create Now.

  4. Log in to your Docker client as the root user.
  5. Pull the image of the earlier version to a local directory by following the procedure for downloading images in the earlier CCE version.

    NOTE:

    Log in to the console of the earlier CCE version, choose Container Registry in the navigation pane, and click the name of the image to be downloaded. On the image details page that is displayed, you can view the corresponding Container Image Pull Command.

    Example command:

    docker pull 10.154.57.150:443/test/apache-php:latest

  6. Connect to CCE.

    1. Log in to the console of the latest CCE version and click the name of the image repository to be uploaded. The image repository details page is displayed.
    2. On the Pull/Push Guide tab page, click Generate the Docker login command, as shown in Figure 2.
      Figure 2 Generating a Docker login command
    3. In the displayed Docker login command, click to copy the command.
      NOTE:

      In the preceding example, images are uploaded from an external network. If you upload images from an internal network, change the IP address after Generate the Docker login command to the IP address in Private image address, for example, change 172.16.32.24 to 10.125.1.15:20202.

  7. Log in to the server where Docker is installed. Then, run the Docker login command copied in the previous step.

    After you successfully log in to the Docker client, "login succeeded" is displayed.

  8. Run the following command to tag the nginx:1.10 image:

    docker tag {imageid} {image address}:tag

    In the preceding command, image address refers to the current image repository address in the Pull/Push Guide tab of Figure 2. If you are uploading an image from an external network, enter your external image address. If you are uploading an image from an internal network, enter the internal image address.

    Example command:

    docker tag 2e233ad9329b 10.125.1.15:20202/test/apache-php:latest

  9. Run the following command to push the image to the image repository:

    docker push {image address}:tag

    Example command:

    docker push 10.125.1.15:20202/test/apache-php:latest

    The image is successfully pushed if the following information is displayed:

    6d6b9812c8ae: Pushed 
    695da0025de6: Pushed 
    fe4c16cbf7a4: Pushed 
    1.10: digest: sha256:eb7e3bbd8e3040efa71d9c2cacfa12a8e39c6b2ccd15eac12bdc49e0b66cee63 size: 948

    On the CCE console, refresh the Image Repository > imagename page of the image repository. The uploaded image is displayed in the image list.