<p>I am trying to do some ssh + git sub module builds, and initially I was getting this error when trying to pull code:</p>
<pre><code>Submodule 'xxx' (git@host:thing/subdir/repo.git) registered for path 'repo'
Submodule 'yyy' (git@host:thing/subdir/yyy.git) registered for path 'yyy'
Cloning into '/home/jenkins/agent/workspace/thing/AAA/releaser/xxx'...
No user exists for uid 1000
fatal: Could not read from remote repository.
</code></pre>
<p>Which led me to <a href="https://github.com/bitnami/bitnami-docker-jenkins/issues/60#issuecomment-1112459364" rel="nofollow noreferrer">this solution</a>:</p>
<pre><code>       securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
            - all
          readOnlyRootFilesystem: true
          runAsNonRoot: true
          runAsUser: 65534
</code></pre>
<p>Now, this worked, but I was seeing some non critical errors about not being able to save the host key to /.ssh, but it still checked out the code and so I didn't care since every run is like it's the first time.</p>
<p>However, I am now running into a different problem that really requires me to solve this user issue permanently:</p>
<pre><code>+ mc alias set jenkins-user ****
mc: &lt;ERROR&gt; Unable to save new mc config. mkdir /.mc: permission denied.
</code></pre>
<p>I need to run the minio mc client - and when I give it creds it tries to save them to /.mc and it can't and fails the aliasing command, and thus the whole build.</p>
<p>So, I need to figure out a better way to solve the initial user problem, or tell it that, when running in this pod, to use a non privileged directory like /tmp.</p>
<p>So, I am open to a solution to either issue if someone can assist</p>

Christian Bongiorno
<p>Ok, I ended up solving it with a mix of Kubernetes changes and Dockerfile changes.</p>
<p>First, I had to add the Jenkins user with the right user id to a custom docker image that contained what I needed</p>
<pre><code>
FROM minio/mc

RUN  \
     microdnf update --nodocs &amp;&amp; \
     microdnf install git zip findutils --nodocs &amp;&amp; \
     microdnf clean all
RUN adduser --home-dir /home/jenkins/ --shell /bin/sh --uid 1000 jenkins

USER jenkins
WORKDIR /home/jenkins

ENTRYPOINT [&quot;sh&quot;]
</code></pre>
<p>Then, I had to update the pod definition to run under the same user that it was complaining about before:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Pod
metadata:
  annotations: {}
spec:
  securityContext:
    allowPrivilegeEscalation: false
    runAsUser: 1000
  containers:
    -
      name: releaser
      image: docker.io/chb0docker/releaser:latest
      imagePullPolicy: Always
      command:
        - cat
      tty: true
</code></pre>
