Getting Permission issue while creating a directory in custom docker image

Problem Statement

If you are building your code with custom image let’s say maven image, You might see a issue, even though the container is running with “root” user, it throws some permissions issue, due to which it is unable to create some folders.

Your error may look like this

Error:

[INFO] Error: EACCES: permission denied, mkdir '/harness/

Solution

One simple solution could be simply changing the owner for that folder with below command.

chown -R $(id -u) /harness

Coming to the solution

image

Finally after this, As part of the git clone step Harness uses Internal container inside the build farm pod and by default it will run as uid 1000 and in order to run it as root user you need to change the permission in Infrastructure Step which is inside Advanced configuration.

Then click on Advance

That’s all for this article Happy Building Deploying and Much more with Harness

3 Likes