Image pull policy
Esc
Start typing to search...
On this page

Image pull policy

To manage image updates and optimize pod startup performance in OpenShift Container Platform, you can configure the imagePullPolicy parameter in your container specifications. This setting controls when container images are pulled from registries.

About the imagePullPolicy parameter

To control when OpenShift Container Platform pulls container images from registries or uses locally cached copies when starting containers, you can configure the imagePullPolicy parameter. This policy helps you manage image updates and optimize pod startup performance.

The following table lists the possible values for the imagePullPolicy parameter:

imagePullPolicy values

ValueDescription
AlwaysAlways pull the image.
IfNotPresentOnly pull the image if it does not already exist on the node.
NeverNever pull the image.

The following example sets the imagePullPolicy parameter to IfNotPresent for the image tagged v1.2.3:

Example imagePullPolicy configuration
apiVersion: apps/v1
kind: Deployment
# ...
spec:
  # ...
  template:
    spec:
      containers:
      - name: my-app-container
        image: registry.example.com/myapp:v1.2.3
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 8080

where:

spec.template.spec.containers.image

Specifies is the image to use. In this example, the image tag is explicitly set to v1.2.3.

spec.template.spec.containers.imagePullPolicy

Specifies the policy to use. In this example, the policy is set to IfNotPresent because the image tag is not latest.

Omitting the imagePullPolicy parameter

When you omit the imagePullPolicy parameter, OpenShift Container Platform automatically determines the policy based on the image tag. This default behavior ensures that the latest tag always pulls the newest image, while specific version tags use locally cached images when available to improve efficiency.

Image tagimagePullPolicy settingBehavior
latestAlwaysAlways pulls the image. This policy helps ensure that the container always uses the latest version of the image.
Any other tag (for example, v1.2.3, stable, production)IfNotPresentPull only if necessary. This policy uses the locally cached version of the image if it exists on the node, avoiding unnecessary pulls from the registry.