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

Podman does not pull base image by default #21450

Open
bdabelow opened this issue Sep 25, 2024 · 0 comments
Open

Podman does not pull base image by default #21450

bdabelow opened this issue Sep 25, 2024 · 0 comments
Labels
backend: Docker Docker backend-related issues bug

Comments

@bdabelow
Copy link
Contributor

Describe the bug
Packaging docker_image() with podman backend does not pull the base image (in the FROM clause) if it does not already exist locally.
This will cause the build to fail:

23:43:48.89 [ERROR] 1 Exception encountered:

Engine traceback:
  in `package` goal

ProcessExecutionFailure: Process 'Building docker image my-image:latest' failed with exit code 125.
stdout:
STEP 1/3: FROM docker.io/alpine/k8s:1.28.13

stderr:
Error: creating build container: docker.io/alpine/k8s:1.28.13: image not known

Pants version
2.22.0

OS
Linux

Additional info
Can be worked around by setting pull=True on docker_image(), however this will always pull the base image, not only if not existing locally.

Probable cause is differences off --pull between docker and podman

man docker-build:

       --pull true|false
          Always attempt to pull a newer version of the image. The default is false.

man podman-build:

   --pull=policy
       Pull image policy. The default is missing.

              • always: Always pull the image and throw an error if the pull fails.

              • missing: Only pull the image when it does not exist in the local containers storage.  Throw an error if no image is found and the pull fails.

              • never: Never pull the image but use the one from the local containers storage.  Throw an error when no image is found.

              • newer:  Pull if the image on the registry is newer than the one in the local containers storage.  An image is considered to be newer when the digests are different.  Comparing the time stamps is prone to errors.  Pull
                errors are suppressed if a local image was found.

From my understanding podman's missing matches the behaviour of docker's false, podman's newer matches docker's true.

However without pull=True, pants uses --pull=False for both. Apparently though unspecified, False is mapped to never in podman, causing the above error.

I will try to come up with a PR.

@bdabelow bdabelow added the bug label Sep 25, 2024
@bdabelow bdabelow changed the title Pull behavior on image build Pull behavior on image build with podman Sep 25, 2024
@bdabelow bdabelow changed the title Pull behavior on image build with podman Podman does not pull base image by default Sep 25, 2024
@tgolsson tgolsson added the backend: Docker Docker backend-related issues label Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: Docker Docker backend-related issues bug
Projects
None yet
Development

No branches or pull requests

2 participants