Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for specifying an image pull policy for containers #7697

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danegsta
Copy link
Member

Description

Adds a new ContainerPullPolicyAnnotation and WithPullPolicy builder API to allow configuring the container image pull policy for a given container resource. The supported pull policy settings are Always, Missing, and Never. A pull policy of Always will result in the container image always being pulled when the container is run, regardless of whether a version of the image is cached locally. Missing is the default Docker behavior; a cached version of the image will be used if available, otherwise it will be pulled from the registry. Never will never pull images from a remote registry and running the container will fail if the image is not already present in the local image cache.

Furthermore, when building a new image from a Dockerfile, Always will also force pulling any base images as part of the build, Missing will use the default behavior of only pulling images that aren't available locally, and None will have no effect on the build process (there's no equivalent build time flag for None).

Example:

container.WithPullPolicy(PullPolicy.Always);

Fixes #7350

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No (it would be difficult to validate in unit tests whether Docker had pulled an image)
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@Copilot Copilot bot review requested due to automatic review settings February 19, 2025 23:48

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose Image Pull Policy on Containers
1 participant