Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2232127

Summary: Podman's `/build` Docker compatibility API endpoint does not accept "1" as a valid pull parameter.
Product: Red Hat Enterprise Linux 8 Reporter: Matej Vašek <mvasek>
Component: podmanAssignee: Jindrich Novy <jnovy>
Status: CLOSED ERRATA QA Contact: Alex Jia <ajia>
Severity: high Docs Contact:
Priority: unspecified    
Version: 8.9CC: ajia, bbaude, dwalsh, jligon, jnovy, lsm5, mboddu, mheon, pthomas, tsweeney
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: podman-4.6.1-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-14 15:30:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Matej Vašek 2023-08-15 13:35:40 UTC
Description of problem:
The `/build` Docker compatibility API endpoint does not accept "1" as a valid pull parameter.

How reproducible:
Always.
Use standard Docker CLI or Golang client against podman implementation of Docker API.

Steps to Reproduce:
```
podman system service unix:///tmp/docker.sock --log-level=debug --time 0 &
export DOCKER_HOST="unix:///tmp/docker.sock"
echo "FROM alpine" >> Dockerfile
docker build . -t my-alpine --pull
```

Actual results:
```
Error response from daemon: failed to parse query parameter 'pull': "1": invalid pull policy: "1"
```

Expected results:
Build proceeds without error.


Additional info:
This affects versions podman 4.6.x
Related issue: https://issues.redhat.com/browse/SRVOCF-550

FIX:
https://github.com/containers/podman/pull/19631/commits/888a52ded8c1ef9ed32b9525b95ee879add411ea

Comment 2 Paul Holzinger 2023-08-15 16:39:27 UTC
https://github.com/containers/podman/pull/19633 is merged, assigning to Jindrich for packaging work

Comment 8 Matej Vašek 2023-08-31 10:42:23 UTC
"curl" reproducer:
tar -cf - Dockerfile | curl -XPOST --unix-socket /tmp/docker.sock -H 'Content-Type: application/x-tar' "http://localhost/v1.41/build?pull=1" --data-binary @-

Where Docker file is some simple docker file e.g. `FROM alpine`, and /tmp/docker.sock is a unix socket served by podman.

Comment 9 Alex Jia 2023-08-31 11:07:47 UTC
(In reply to Matej Vašek from comment #8)
> "curl" reproducer:
> tar -cf - Dockerfile | curl -XPOST --unix-socket /tmp/docker.sock -H
> 'Content-Type: application/x-tar' "http://localhost/v1.41/build?pull=1"
> --data-binary @-
> 
> Where Docker file is some simple docker file e.g. `FROM alpine`, and
> /tmp/docker.sock is a unix socket served by podman.

Thank you Matej!

I can reproduce this bug on podman-4.6.1-1.module+el8.9.0+19648+0d5ae0ec.

[testuser@kvm-03-guest12 ~]$ tar -cf - Dockerfile | curl -XPOST --unix-socket /home/testuser/docker.sock -H 'Content-Type: application/x-tar' "http://localhost/v1.41/build?pull=1" --data-binary @-
{"cause":"invalid pull policy: \"1\"","message":"failed to parse query parameter 'pull': \"1\": invalid pull policy: \"1\"","response":400}

And verified on podman-4.6.1-4.module+el8.9.0+19761+326da906.

[testuser@kvm-03-guest12 ~]$ tar -cf - Dockerfile | curl -XPOST --unix-socket /home/testuser/docker.sock -H 'Content-Type: application/x-tar' "http://localhost/v1.41/build?pull=1" --data-binary @-
{"stream":"STEP 1/1: FROM quay.io/libpod/alpine:latest\n"}
{"stream":"Trying to pull quay.io/libpod/alpine:latest...\n"}
{"stream":"Getting image source signatures\n"}
{"stream":"Copying blob sha256:9d16cba9fb961d1aafec9542f2bf7cb64acfc55245f9e4eb5abecd4cdc38d749\n"}
{"stream":"Copying config sha256:961769676411f082461f9ef46626dd7a2d1e2b2a38e6a44364bcbecf51e66dd4\n"}
{"stream":"Writing manifest to image destination\n"}
{"stream":"COMMIT\n"}
{"stream":"--\u003e 961769676411\n"}
{"stream":"961769676411f082461f9ef46626dd7a2d1e2b2a38e6a44364bcbecf51e66dd4\n"}
{"aux":{"ID":"sha256:961769676411f082461f9ef46626dd7a2d1e2b2a38e6a44364bcbecf51e66dd4"}}
{"stream":"Successfully built 961769676411\n"}

Comment 11 errata-xmlrpc 2023-11-14 15:30:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: container-tools:rhel8 security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:6939