question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unnecessary overwrites of directories, resulting changes to owners and permissions

See original GitHub issue

The way we took to fix #727 and #523 was to add TAR archive entries to enumerate all parent directories of any given file and explicitly set permissions for those parent directories: PR #891. The consequence is that owner:group is always reset to root:root and the permission mode 755 for all the directories involved.

So, let’s say I have a base Tomcat image where the owner:group and the permission of /usr are 12345:54321 and 750:

$ docker run --rm -it --entrypoint ls francium25/base-tomcat -ld /usr
drwxr-x---    1 12345    54321         4096 Sep 12 20:50 /usr

Now, if Jib builds an image where /usr is one of the parent directories of my <appRoot>,

          <from><image>francium25/base-tomcat</image></from>
          <container>
            <appRoot>/usr/local/tomcat/webapps/ROOT</appRoot>
          </container>

the owner and the permission are reset (to the values we chose).

$ docker run --rm -it --entrypoint ls my-image -ld /usr
drwxr-xr-x    1 root     root          4096 Jan  1  1970 /usr

It will be ideal to not touch the owners and permissions of existing directories.

Also note that <appRoot> and its parent directories will always be root:root and 755.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:5
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
cablespaghetticommented, Mar 5, 2021

Just came across this problem with the jetty:9-jre11-slim image on Docker Hub. I’m using that rather than Distroless for multi-arch (ARM64) support, and for some reason the default entrypoint shell script tries to create a directory in /var/lib/jetty on startup. Here’s the properties I add to get everything working:

        <jib.from.image>jetty:9-jre11-slim</jib.from.image>
        <jib.container.appRoot>/var/lib/jetty/webapps/ROOT</jib.container.appRoot>
        <jib.container.entrypoint>/usr/local/openjdk-11/bin/java,-jar</jib.container.entrypoint>
        <jib.container.args>/usr/local/jetty/start.jar</jib.container.args>
        <jib.container.user>nobody</jib.container.user>

Hope it’s useful to somebody. 😃

1reaction
chanseokohcommented, Dec 7, 2020

FTR: #1257 is resolved using a Jib extension. This issue is documented as one of the known limitations of the extension, where there is a workaround.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to take ownership and change permissions for blocked ...
The error occurs because the Administrators have been removed from file permissions and do not have ownership of the files,folders/directories.
Read more >
Securing file permissions and ownership | Drupal.org
The code below demonstrates one method for changing the ownership and permissions of files and directories in the Drupal Root directory to confirm...
Read more >
Take Ownership of Windows Folder and Files - Blog
Taking ownership of files and folders will give user capability to override restrictions and allow them to perform the necessary task. However, ...
Read more >
What is Umask and How To Setup Default umask Under Linux?
All UNIX users can override the system umask defaults in their ... The myapp1 directory permissions for other changes from read and execute ......
Read more >
Change permissions for files, folders, or disks on Mac
You can undo any changes to an item's owner in the Sharing & Permissions section since opening the Info window. Before closing the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found