Bug 1746022 - Podman builds do not work with --squash
Summary: Podman builds do not work with --squash
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: buildah
Version: 30
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tom Sweeney
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-08-27 13:32 UTC by Marek Goldmann
Modified: 2019-09-04 23:01 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:


Attachments (Terms of Use)
Dockerfile (121 bytes, text/plain)
2019-08-27 13:32 UTC, Marek Goldmann
no flags Details

Description Marek Goldmann 2019-08-27 13:32:40 UTC
Created attachment 1608585 [details]
Dockerfile

Description of problem:

When the --squash switch is used, multi-stage builds fail to complete.

Version-Release number of selected component (if applicable):

podman-1.5.1-3.fc30.x86_64

How reproducible:

Always

Steps to Reproduce:
1. Take the attached Dockerfile
2. echo "Aaa" > artifact
3. Run "podman build --squash ."

Actual results:

Build is failing.

Expected results:

Build is succeeding.

Additional info:

Logs:

STEP 1: FROM centos:7 AS builder
Getting image source signatures
Copying blob d8d02d457314 done
Copying config 67fa590cfc done
Writing manifest to image destination
Storing signatures
STEP 2: USER root
50064bbc0337a3887d23326cf72deffbe5139c370af575029dd2906aa879cd6b
STEP 3: COPY artifact /artifact
Error: error building at STEP "COPY artifact /artifact": error determining run uid: user: unknown user error looking up user "root"

Comment 1 Matthew Heon 2019-08-27 13:37:53 UTC
Transferring to Buildah as we use Buildah to perform builds.

Comment 2 Marek Goldmann 2019-08-27 13:41:25 UTC
That's true, but the same code work perfectly with Buildah:

$ buildah build-using-dockerfile --squash .
STEP 1: FROM centos:7 AS builder
Getting image source signatures
Copying blob d8d02d457314 done
Copying config 67fa590cfc done
Writing manifest to image destination
Storing signatures
STEP 2: USER root
STEP 3: COPY artifact /artifact
STEP 4: FROM centos:7
STEP 5: COPY --from=builder /artifact /target-artifact
STEP 6: COMMIT
Getting image source signatures
Copying blob c691ea77381a done
Copying config 353d36543f done
Writing manifest to image destination
Storing signatures
353d36543fe09293da661deb8d804709b786ec51a1d175cb9d35ea994b3701cc

And it fails with Podman.

buildah-1.10.1-2.git8c1c2c5.fc30.x86_64

Comment 4 Matthew Heon 2019-08-27 13:45:31 UTC
Likely a matter of defaults, then. Podman defaults '--layers' to true (and one other I'm forgetting). I'd imagine rulling 'buildah bug --layers=true' will have the same result as Podman.

Comment 5 Marek Goldmann 2019-08-27 13:49:08 UTC
I can confirm above, with "--layers=true" it fails.

$ buildah build-using-dockerfile --layers=true --squash .                             
STEP 1: FROM centos:7 AS builder
Getting image source signatures
Copying blob d8d02d457314 done
Copying config 67fa590cfc done
Writing manifest to image destination
Storing signatures
STEP 2: USER root
27884b3ce01a53ea2c1567f90a1cbf71884e5da05844ebe6f3429044b585b062
STEP 3: COPY artifact /artifact
error building at STEP "COPY artifact /artifact": error determining run uid: user: unknown user error looking up user "root"
ERRO[0012] exit status 1

Comment 6 Daniel Walsh 2019-08-27 14:46:04 UTC
podman build --layers=false ...

Should probably work.  Now we need to determine if it should work when --layers=true

Comment 7 Marek Goldmann 2019-09-04 10:44:35 UTC
I have confirmed that this is not limited to multi-stage builds. Reproducer:

FROM alpine:3.10
USER root
COPY Dockerfile /tmp/

Log:

$ podman build --squash .              
STEP 1: FROM alpine:3.10
Getting image source signatures
Copying blob 9d48c3bd43c5 done
Copying config 9617696764 done
Writing manifest to image destination
Storing signatures
STEP 2: USER root
7e8bd5cfbf0c8d7b6bb346fea529a0bd5da13ce6940de43362fcfc8947163aa9
STEP 3: COPY Dockerfile /tmp/
Error: error building at STEP "COPY Dockerfile /tmp/": error determining run uid: user: unknown user error looking up user "root"

Comment 8 Daniel Walsh 2019-09-04 18:19:01 UTC
Seems to work fine with buildah

$ buildah bud -f /tmp/Dockerfile1 --squash /tmp/
STEP 1: FROM alpine:3.10
STEP 2: USER root
STEP 3: COPY Dockerfile /tmp/
STEP 4: COMMIT
Getting image source signatures
Copying blob 4ebfff4bc645 done
Copying config c0bbe46e70 done
Writing manifest to image destination
Storing signatures
--> c0bbe46e70d9262f2e9cc7dec06e1f387a10a201f6f02394f17cae3f4ec68812

Comment 9 Daniel Walsh 2019-09-04 18:23:52 UTC
Buildah blows up with --layers=true

$ buildah bud -f /tmp/Dockerfile1 --layers=true --squash /tmp
STEP 1: FROM alpine:3.10
STEP 2: USER root
--> 31de45d0d8f801bd9cd40311346a6f6a3806981341ea0f99e98a96e3d3d42b20
STEP 3: COPY Dockerfile /tmp/
error building at STEP "COPY Dockerfile /tmp/": error determining run uid: user: unknown user error looking up user "root"
ERRO[0000] exit status 1


Note You need to log in before you can comment on or make changes to this bug.