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 1785480 - podman reuses wrong cached image
Summary: podman reuses wrong cached image
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: buildah
Version: 8.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.2
Assignee: Jindrich Novy
QA Contact: atomic-bugs@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-12-20 01:00 UTC by Moss Uchida
Modified: 2020-07-21 15:32 UTC (History)
9 users (show)

Fixed In Version: podman-1.9.x and newer
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-21 15:31:54 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2020:3053 0 None None None 2020-07-21 15:32:28 UTC

Description Moss Uchida 2019-12-20 01:00:00 UTC
Description of problem:
When run podman build, it is successful for the first image, however, if the instruction is the same for the next image, it falsely use the same image from cache, which causes inconsistency in the image

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


How reproducible:
It happens every time.  I can reproduce easily

Steps to Reproduce:
1. git clone  -b master --single-branch https://github.com/blueperf/acmeair-flightservice-java
2. mvn clean package
3. podman build . -t quay.io/QUAYUSER/REPOSITORY:TAG

#It does the following:
STEP 2: COPY src/main/liberty/config/server.xml /config/server.xml
1602f603374c0245ff653a947e4f20c04bced1837216362ab2062ec16a4c9b84

4. git clone  -b master --single-branch https://github.com/blueperf/acmeair-customerservice-java
5. mvn clean package

6. podman build . -t quay.io/QUAYUSER/REPOSITORY:TAG

It uses the cache from #3 above:
STEP 2: COPY src/main/liberty/config/server.xml /config/server.xml
--> Using cache 1602f603374c0245ff653a947e4f20c04bced1837216362ab2062ec16a4c9b84

HOWEVEFR, these src/main/liberty/config/server.xml have different contents (e.g. they have different war files), podman CANNOT reuse the same image. it MUST create a new image!!

Now the image run with the correct war file with the WRONG server.xml.  PLEASE do not reuse it from the cache.  Please create another image - even though their sizes are the same, they can be different content!!!

Actual results:
server.xml from acmeair-flightservice-java is used for acmeair-customerservice-java

Expected results:
server.xml from acmeair-flightservice-java is for acmeair-flightservice-java image, server.xml from acmeair-customerservice-java should be used for acmeair-customerservice-java image.


Additional info:
# podman version
Version:            1.4.2-stable3
RemoteAPI Version:  1
Go Version:         go1.12.12
OS/Arch:            linux/amd64

Comment 1 Matthew Heon 2019-12-31 02:07:47 UTC
Changing component to Buildah, as `podman build` uses Buildah code to perform builds.

Comment 2 Tom Sweeney 2020-06-03 22:28:40 UTC
This is fixed in Podman v1.9+ and should be in RHEL 8.2.1.

Storing signatures
STEP 2: COPY --chown=1001:0 src/main/liberty/config/server.xml /config/server.xml
--> b2901865f80
STEP 3: COPY --chown=1001:0 src/main/liberty/config/server.env /config/server.env

Second build:
STEP 2: COPY --chown=1001:0 src/main/liberty/config/server.xml /config/server.xml
--> 14fb3f24f99

Setting to Modified and assigning to Jindrich in case there's further BZ tweaking needed.

Comment 7 Joy Pu 2020-06-19 09:23:03 UTC
Test with podman-1.9.3-2.module+el8.2.1+6867+366c07d6.x86_64, and comments out the line for copy java war file in the Dockerfile(the mvn version installed in my host have a bug). And it now works as expect. The build will not reuse the cache image. So set this to verified. Details:

[root@kvm-01-guest13 acmeair-flightservice-java]# podman build . -t quay.io/test
STEP 1: FROM open-liberty:kernel
Getting image source signatures
Copying blob 322ed380e680 done  
Copying blob 131f805ec7fd done  
Copying blob 205a7ec514d2 done  
Copying blob 6ac240b13098 done  
Copying blob 783fe3f38ac2 done  
Copying blob d7c3167c320d done  
Copying blob d84c2fe266cf done  
Copying blob 5b5f161f0cc5 done  
Copying blob 6c5d85eb9c6e done  
Copying blob fbb3262df79b done  
Copying blob 674061a1838a done  
Copying blob 1b4e8cb7a57e done  
Copying config 1a694e96af done  
Writing manifest to image destination
Storing signatures
STEP 2: COPY --chown=1001:0 src/main/liberty/config/server.xml /config/server.xml
--> aff8610c122
STEP 3: COPY --chown=1001:0 src/main/liberty/config/server.env /config/server.env
--> b5836731ec3
STEP 4: COPY --chown=1001:0 src/main/liberty/config/jvm.options /config/jvm.options
--> fa6bc1c8d78
STEP 5: ARG CREATE_OPENJ9_SCC=true
--> 5abcdbd0ba0
STEP 6: ENV OPENJ9_SCC=${CREATE_OPENJ9_SCC}
--> 0d4b9758a2b
STEP 7: RUN configure.sh
STEP 8: COMMIT quay.io/test
--> b22d503cd8e
b22d503cd8e4500de363576f8dbc552f007ce496675b58e9c39fc7fa676880f2
[root@kvm-01-guest13 acmeair-customerservice-java]# podman build . -t quay.io/test
STEP 1: FROM open-liberty:kernel
STEP 2: COPY --chown=1001:0 src/main/liberty/config/server.xml /config/server.xml
--> d3e8d17f0e7
STEP 3: COPY --chown=1001:0 src/main/liberty/config/server.env /config/server.env
--> c43f25969f7
STEP 4: COPY --chown=1001:0 src/main/liberty/config/jvm.options /config/jvm.options
--> d59855431e0
STEP 5: ARG CREATE_OPENJ9_SCC=true
--> 8ccb963f97d
STEP 6: ENV OPENJ9_SCC=${CREATE_OPENJ9_SCC}
--> 93d65dab55a
STEP 7: RUN configure.sh
STEP 8: COMMIT quay.io/test
--> 063f02beb48
063f02beb48104b1be5beab08dea302a0ca24d6a19c35808bc374ee4d2205847

# podman  run 063f02beb48104b1be5beab08dea302a0ca24d6a19c35808bc374ee4d2205847 cat /config/server.xml
<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
  <!-- Enable features -->
  <featureManager>
    <feature>microProfile-3.3</feature>
  </featureManager>

  <!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
  <httpEndpoint id="defaultHttpEndpoint" host="*"
              httpPort="9080" httpsPort="9443">
  </httpEndpoint>

  <quickStartSecurity userName="${env.USERNAME}" userPassword="${env.PASSWORD}" />

  <webApplication name="acmeair-customerservice" location="acmeair-customerservice-java-3.3.war" contextRoot="/customer">
    <!-- enable visibility to third party apis -->
    <classloader apiTypeVisibility="api,ibm-api,spec,stable,third-party"/>
  </webApplication>

</server>

# podman  run b22d503cd8e4500de363576f8dbc552f007ce496675b58e9c39fc7fa676880f2 cat /config/server.xml
<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
  <!-- Enable features -->
  <featureManager>
    <feature>microProfile-3.3</feature>
  </featureManager>

  <!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
  <httpEndpoint id="defaultHttpEndpoint" host="*"
                httpPort="9080" httpsPort="9443">
  </httpEndpoint>
   
  <quickStartSecurity userName="${env.USERNAME}" userPassword="${env.PASSWORD}" />

  <webApplication name="acmeair-flightservice" location="acmeair-flightservice-java-3.3.war" contextRoot="/flight">
    <!-- enable visibility to third party apis -->
    <classloader apiTypeVisibility="api,ibm-api,spec,stable,third-party"/>
  </webApplication>
</server>

Comment 9 errata-xmlrpc 2020-07-21 15:31:54 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, 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-2020:3053


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