Help Center/ Cloud Container Instance/ FAQs/ Workload Abnormalities/ What Do I Do If an Event Indicating That the Image Failed to Be Pulled Occurs?
Updated on 2023-08-23 GMT+08:00

What Do I Do If an Event Indicating That the Image Failed to Be Pulled Occurs?

If the details page of a workload shows an event indicating that the image fails to be pulled, perform the following operations to locate the fault:

Check Item 1: imagePullSecret (This Is Required When You Use kubectl to Create a Workload)

In the following example, a Deployment named nginx is created. Check whether the .yaml file contains the imagePullSecrets field (bold field in the following information), which indicates the name of the secret used for pulling the image.

To pull an image from the SoftWare Repository for Container (SWR), set this field to imagepull-secret.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  strategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx:alpine
        imagePullPolicy: Always
        name: nginx
      imagePullSecrets:
        - name: imagepull-secret

Check Item 2: Image Address

CCI allows you to create workloads using images pulled from SWR.

SWR images can be obtained by using Image Pull Command. After an image is pushed, you can obtain its address.

Figure 1 Template address

Check Item3: IAM Users' Permissions to Download Images

If you have enabled the Enterprise Management service, you need to use your account to grant IAM users with permissions to access SWR so that the IAM users can download private images of the account.

You can grant permissions to IAM users in either of the following ways:

  • Grant permissions on the image details page. After permissions granted, IAM users can read, edit, and manage the image. For more details, see Granting Permissions of a Specific Image.
  • Grant permissions on the organization details page. After permissions granted, IAM users can read, edit, and manage all images in the organization. For more details, see Granting Permissions of an Organization.

Check Item 4: Docker Version Used for Image Packaging

The workload fails to pull the image, and the following error information is displayed:

failed to pull and unpack image "****": failed to unpack image on snapshotter devmapper: failed to extract layer

sha256:xxxxxx: failed to get reader from content store: content digest sha256:xxxxxx: not found

The error message is as follows:

Figure 2 Error message

Cause: The Docker version used to build the image is outdated (earlier than v1.10). Some image packaging standards are no longer supported by the community.

Solution: Use Docker v1.11 or later to rebuild the image and push it to SWR, upgrade the workload image tag and pull it again.