Help Center/ Cloud Container Engine/ User Guide (Ankara Region)/ FAQs/ Workload/ Others/ What Is the Image Pull Policy for Containers in a CCE Cluster?
Updated on 2024-12-04 GMT+08:00

What Is the Image Pull Policy for Containers in a CCE Cluster?

A container image is required to create a container. Images may be stored locally or in a remote image repository.

The imagePullPolicy field in the Kubernetes configuration file is used to describe the image pull policy. This field has the following value options:

  • Always: Always force a pull.
    imagePullPolicy: Always
  • IfNotPresent: The image is pulled only if it is not already present locally.
    imagePullPolicy: IfNotPresent
  • Never: The image is assumed to exist locally. No attempt is made to pull the image.
    imagePullPolicy: Never

Description

  1. If this field is set to Always, the image is pulled from the remote repository each time a container is started or restarted.

    If imagePullPolicy is left blank, the policy defaults to Always.

  2. If the policy is set to IfNotPreset:
    1. If the required image does not exist locally, it will be pulled from the remote repository.
    2. If the content, except the tag, of the required image is the same as that of the local image, and the image with that tag exists only in the remote repository, Kubernetes will not pull the image from the remote repository.