Dockerfile icon indicating copy to clipboard operation
Dockerfile copied to clipboard

UID other than 1000

Open TimBBP opened this issue 4 years ago • 3 comments

Apologies if this is already covered somewhere, but I can't find much information about it.

On some recent deployments, I've run into permissions issues with files where the UID of the current user is not 1000 (it's 1001 in this case).

I found this issue: https://github.com/webdevops/Dockerfile/issues/217 which was closed with apparently no resolution (along with the linked PR).

One of the suggestions in that conversation was to add some commands to the Dockerfile, but unless I've misunderstood something, that doesn't make it very portable. The unmerged PR seemed to allow for setting a UID override as an environment variable, which sounded to me like it would cure the problem.

Is there a way to make this work on systems where the UID isn't 1000?

Thanks in advance

TimBBP avatar Jun 17 '21 16:06 TimBBP

Even running as a user ID 1000 still seems to be broken: #298

splitbrain avatar Mar 02 '22 09:03 splitbrain

Same problem here. I created a docker-compose with the apache-php container and specified the user parameter with uid there. Works a few days and then the container restart and does not start again ('failed switching to "root"', same as here) until I start it as root.

hahrens avatar Mar 24 '22 19:03 hahrens

Check your usermod and groupmod id -u id -g if that is not 1000 then run the following command on your web container to give the proper usermod and groupmod to the application user.

docker exec -uroot YOUR_CONTAINER_NAME /bin/bash -c "usermod -u 1001 application" docker exec -uroot YOUR_CONTAINER_NAME /bin/bash -c "groupmod -g 1001 application"

1001 are the respective values

uisuru avatar Nov 11 '22 01:11 uisuru