Updated on 2024-06-19 GMT+08:00

Pulling an Image

Scenario

You can run the docker pull command to pull images from SWR.

Prerequisite

  • Before pulling an image, ensure that your network connection is normal.
  • Before pulling an image, contact the administrator to grant the SWR pull permission on the IAM console. For details, see Permissions Management.
  • On the My Images page, Private Images list your own images in your organization and Shared Images list private images shared by other users in the organization.
  • After an IAM user is created, the administrator needs to grant permissions to the user in the organization so that the user can read and edit images in the organization. For details, see User Permissions.

Pulling an Image from My Images

  1. Log in to the VM running the container engine as the root user.
  2. Obtain a login command by referring to 2 and access SWR.
  3. Log in to the SWR console.
  4. In the navigation pane, choose My Images and click the name of the target image.
  5. On the Image Tags tab page, in the same row as the target image tag, click in the Image Pull Command column to copy the command.

    Figure 1 Obtaining the image pull command

  6. Run the image pull command obtained in 5 on the VM.

    Example: docker pull swr.cn-east-3.myhuaweicloud.com/group/nginx:v2.0.0

    Run the docker images command to check whether the image is successfully pulled.

    # docker images
    REPOSITORY                                                              TAG       IMAGE ID       CREATED         SIZE
    swr.cn-east-3.myhuaweicloud.com/group/nginx                             v2.0.0    22f2bf2e2b4f   5 hours ago     22.8MB

  7. (Optional) Run the following command to save the image as an archived file:

    docker save [Image name:tag name] > [Archived file name]

    Example: docker save swr.cn-east-3.myhuaweicloud.com/group/nginx:v2.0.0 > nginx.tar

Pulling an Image from the Image Center

You can directly pull an image from the Image Center without specifying a repository address. For example, you can connect the VM where the container engine resides with SWR and run the following command to directly pull the mongo image:

docker pull mongo:4.1

Figure 2 mongo image details