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 1808483 - Workdir doesn't have correct ownership with podman build
Summary: Workdir doesn't have correct ownership with podman build
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: podman
Version: 8.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.2
Assignee: Tom Sweeney
QA Contact: atomic-bugs@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-02-28 15:50 UTC by Urvashi Mohnani
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:
pm-rhel: mirror+


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 Urvashi Mohnani 2020-02-28 15:50:54 UTC
Description of problem:

When using WORKDIR in a dockerfile and running podman build, the working directory does not have the correct ownership, so the user fails to write to it when needed.

Using image registry.access.redhat.com/ubi8/go-toolset:1.12.8-32 as the example here which has user set to 1001 (default).

When building a simple Dockerfile like

FROM registry.access.redhat.com/ubi8/go-toolset:1.12.8-32
WORKDIR $HOME/build/
RUN ls -al $HOME
RUN touch testfile

We get this error

STEP 1: FROM registry.access.redhat.com/ubi8/go-toolset:1.12.8-32 AS build
STEP 2: LABEL stage=build
STEP 3: RUN id
uid=1001(default) gid=0(root) groups=0(root)
STEP 4: WORKDIR $HOME/build/
STEP 5: RUN ls -al $HOME
total 28
drwxr-xr-x. 1 default root 4096 Feb 26 22:01 .
drwxr-xr-x. 1 default root 4096 Jan 29 20:33 ..
drwxr-xr-x. 1 default root 4096 Jan 29 20:33 .pki
drwxr-xr-x. 2 root root 4096 Feb 26 22:01 build
STEP 6: RUN touch testfile
touch: cannot touch 'testfile': Permission denied
error building at STEP "RUN touch testfile": error while running runtime: exit status 1

Here we can see that the working directory build has root root as the ownership, hence touching a file as user 1001 fails with permission denied.

With this patch, the same Dockerfile works fine and this is the output

STEP 1: FROM registry.access.redhat.com/ubi8/go-toolset:1.12.8-32 AS build
STEP 2: LABEL stage=build
STEP 3: RUN id
uid=1001(default) gid=0(root) groups=0(root)
STEP 4: WORKDIR $HOME/build/
STEP 5: RUN ls -al $HOME
total 28
drwxr-xr-x. 1 default root 4096 Feb 26 22:01 .
drwxr-xr-x. 1 default root 4096 Jan 29 20:33 ..
drwxr-xr-x. 1 default root 4096 Jan 29 20:33 .pki
drwxr-xr-x. 2 default root 4096 Feb 26 22:01 build
STEP 6: RUN touch testfile



This has been fixed in buildah by https://github.com/containers/buildah/pull/2189 and in podman by https://github.com/containers/libpod/pull/5338.
Just need this to be shipped out in the next release

Comment 7 Daniel Walsh 2020-06-08 21:30:25 UTC
We will not be updating rhel 8.2 this will happenin rhel8.2.1

Comment 12 Joy Pu 2020-06-16 10:27:02 UTC
Test with podman-1.9.3-2.module+el8.2.1+6867+366c07d6.x86_64 and add one line check inside the Dockerfile. Seems it works as expect. So set this to verified. Details:
# podman build -t test .
STEP 1: FROM registry.access.redhat.com/ubi8/go-toolset:1.12.8-32
STEP 2: WORKDIR $HOME/build/
--> 2e79cfd86eb
STEP 3: RUN ls -al $HOME
total 0
drwxr-xr-x. 1 default root 19 Jun 16 10:25 .
drwxr-xr-x. 1 default root 17 Jan 29 20:33 ..
drwxr-xr-x. 1 default root 19 Jan 29 20:33 .pki
drwxr-xr-x. 2 default root  6 Jun 16 10:25 build
--> 0423a632fca
STEP 4: RUN touch testfile
--> 966bdf1f02b
STEP 5: RUN ls -al $HOME/build/
total 0
drwxr-xr-x. 1 default root 22 Jun 16 10:25 .
drwxr-xr-x. 1 default root 19 Jun 16 10:25 ..
-rw-r--r--. 1 default root  0 Jun 16 10:25 testfile
STEP 6: COMMIT test
--> 923ad708f1d
923ad708f1d3d10955324f116917db4e86d1435e52053004ec0d94e5ad396c24

Comment 14 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.