Bug 1730446

Summary: Imagebuilder - Copying files in between stages is unexpectedly failing
Product: Red Hat Enterprise Linux 7 Reporter: Rogerio Bastos <rogbas>
Component: dockerAssignee: Nalin Dahyabhai <nalin>
Status: CLOSED CURRENTRELEASE QA Contact: atomic-bugs <atomic-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.7CC: ajia, amurdaca, aos-bugs, bparees, dornelas, dwalsh, gmontero, jnovy, jokerman, lsm5, mmccomas, nalin, sgarciam, tsweeney, yselkowi
Target Milestone: rcKeywords: Extras
Target Release: 7.8   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-06-10 09:32:29 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:
Bug Depends On:    
Bug Blocks: 1186913    

Description Rogerio Bastos 2019-07-16 18:08:20 UTC
Description of problem:

When running imagebuilder with the following sample Dockerfile, copying a file in between stages is failing silently.


How reproducible: Always


Steps to Reproduce:
Run imagebuilder with the sample Dockerfile:


FROM openshift/origin-cli:v3.11 AS builder
RUN ls -l /bin/oc
# Multistage with python
FROM python:2.7.15 AS runner

# Bring oc binary to python image
COPY --from=builder /bin/oc /bin/

RUN ls -l /bin/oc


Actual results:
--> FROM openshift/origin-cli:v3.11 as builder
--> RUN ls -l /bin/oc
-rwxr-xr-x. 1 root root 120627192 Jul  5 15:09 /bin/oc
--> FROM python:2.7.15 as runner
--> COPY --from=builder /bin/oc /bin/
--> RUN ls -l /bin/oc
ls: cannot access '/bin/oc': No such file or directory
running 'ls -l /bin/oc' failed with exit code 2


Expected results:
The oc binary should be copied to the second stage

Additional info:
$ imagebuilder --version
1.1-dev

Comment 1 Ben Parees 2019-07-16 18:13:19 UTC
Note that the following dockerfile does work:

FROM openshift/origin-cli:v3.11 AS builder

RUN cp /bin/oc /

# Multistage with python
FROM python:2.7.15 AS runner

# Bring oc binary to python image
COPY --from=builder /oc /bin/


So copying the file into a new layer in the stage 0 image, makes it available to COPY --from in stage 1.


The main implication of this is it breaks ocp 3.11 multistage builds (which rely on imagebuilder under the covers).

Comment 2 Ben Parees 2019-07-16 18:14:36 UTC
this can be reproduced using the imagebuilder CLI tool.

Comment 3 Daniel Walsh 2019-07-17 09:48:12 UTC
I take it that this is not an issue with Buildah running the build but with the Docker.sock since this is openshift 3.11?

So not sure why this is assigned to Nalin?

Comment 4 Ben Parees 2019-07-17 14:16:30 UTC
It's not a buildah issue, it is an imagebuilder issue (it occurs both when running imagebuilder on the cli, as well as in OCP3.11 when builds use imagebuilder to build multistage dockerfiles).

Since the containers team owns imagebuilder(right?), it was assigned to that component... not sure who within the team is the right assignee.

Comment 5 Daniel Walsh 2019-07-17 21:10:54 UTC
Ok, We can leave it with Nalin for now, but I will add Tom as well.

Comment 8 Nalin Dahyabhai 2019-08-06 14:45:05 UTC
I mistakenly linked this bug to the PR against the master branch, and not the 3.11 branch.

Comment 9 Nalin Dahyabhai 2019-08-06 17:59:30 UTC
Moving back to assigned for the final PR to get this into origin's 3.11 branch.

Comment 22 Tom Sweeney 2020-06-09 20:51:42 UTC
Nalin's PR (https://github.com/openshift/origin/pull/23562) was closed in December of 2019.  Nalin/Jindrich can we close this now?  I don't believe there's any further packaging needs for this at this time.

Comment 23 Jindrich Novy 2020-06-10 09:32:29 UTC
Assuming this is now part of openshift/origin and no longer an issue. If it is, please reopen.

Comment 24 Red Hat Bugzilla 2023-09-14 05:31:57 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days