title: Give r/w access to a rootless container on Docker running on a Synology NAS
body: <p>I'm trying to write a rootless container capable to sort files in a mounted volume. The goal is to pull the container on my Synology NAS and, using the terminal, run the command in the target folder. I named the project <em>pholderise</em>, and I uploaded <a href="https://github.com/ptommasi/pholderise" rel="nofollow noreferrer">the source code on GitHub</a> and pushed the image <a href="https://hub.docker.com/r/pierpytom/pholderise" rel="nofollow noreferrer">on docker hub</a>.</p>
  <p>To summarize the container characteristics:</p>
  <ul>
  <li>It is based on Red Hat UBI 8, rootless</li>
  <li>User is named &quot;default&quot;, id is 1001</li>
  <li>It has the <em>pholderise</em> command in its path</li>
  </ul>
  <p>Meanwhile, the host:</p>
  <ul>
  <li>It's a Synology NAS, and therefore I use the Docker application provided by Synology (and I'd rather to avoid the command line)</li>
  <li>I have many users, but the one with the data has ID 1026 (group id 100, if worth knowing)</li>
  </ul>
  <p>Going to the deploy on the Synology, my option to mount volumes are quite limited (and no <em>z</em> or <em>Z</em> flag available):
  <a href="https://i.stack.imgur.com/yjPmI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yjPmI.png" alt="enter image description here" /></a></p>
  <p>And if I create a bash shell (from the UI), I can see the mount point <em>/photo</em>:
  <a href="https://i.stack.imgur.com/IyfDE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IyfDE.png" alt="enter image description here" /></a></p>
  <p>And here lies the issue: the user of the container is 1001, but the owner of the data is 1026, so any access is currently denied. The UBI image doesn't have a PUID / UID mechanism, and therefore I need to figure out something by myself.</p>
  <p>I thought of a few options:</p>
  <ul>
  <li>Write a bash script that creates a new user with a given ID (in this case 1026) and switch to it (e.g. <a href="https://serverfault.com/questions/75620/ubuntu-let-a-user-run-a-script-with-root-permissions">editing the sudoers file</a>).</li>
  <li>Write an entrypoint <a href="https://github.com/linuxserver/docker-baseimage-alpine/blob/master/root/etc/cont-init.d/10-adduser" rel="nofollow noreferrer">similar to linuxserver.io</a> to handle the PUID environment variable. But it would be painful to write because it has to start rootless (user id cannot change until the same user has an active process).</li>
  <li>Give up the rootless philosophy, admit defeat and go straight to root.</li>
  </ul>
  <p>My main use case is to stay within the Docker application provided by Synology (I mostly use the NAS through quickconnect, no ssh port opened, so no command line), and I'm wondering if there is a simple solution to my problem.</p>