docker-nexus3 icon indicating copy to clipboard operation
docker-nexus3 copied to clipboard

[NEXUS-14427] Usage of the UID via environment

Open khmarbaise opened this issue 7 years ago • 9 comments

Introduced the usage of an environment variable for the user id to be used instead of hard coding it.

This pull request makes the following changes:

  • NEXUS-14427

khmarbaise avatar Sep 23 '17 20:09 khmarbaise

+1. I want to be able to run the nexus container with a different UID to prevent confusion on the host server (UID 200 is already taken by another user on our servers...).

jansohn avatar Mar 29 '19 09:03 jansohn

+1

woa7 avatar Dec 31 '19 04:12 woa7

Since we moved to the UBI doesn’t it run as a random uid??

CMYanko avatar Dec 31 '19 14:12 CMYanko

Should this be a build arg instead? the user is created during image build cycle and if you use another id than 200 in docker run it should not work.

jonashartwig avatar May 06 '20 07:05 jonashartwig

@jonashartwig I'm against having this being a build arg, makes it impossible to just change it for different container-instances.

FibreFoX avatar May 06 '20 07:05 FibreFoX

Hi, it can be build arg and env. However, i fail to understand how this would work. docker build . -t nexus then docker run -d -p 8081:8081 --env USERID=$(id -u) nexus where id -u returns 300. How will this work?

jonashartwig avatar May 06 '20 07:05 jonashartwig

Oh stupid me :) you are right @jonashartwig, no idea why this slipped my mind ... the user gets added at build-time. Maybe this should be changed too? Like "once per container"? The problem I see is this being hardcoded, so I would be forced to create my own Dockerfile to override this. Not sure which solution would be better: build-time or execution-time?! But whatever solution get's picked, it is better than current state where this is hard-coded.

FibreFoX avatar May 06 '20 07:05 FibreFoX

Openshift (Kubernetes like system) assigns a random UID / GID. The trick is to make a lot of world writable directories, and not assume you can get any homedirs or passwd entries that make sense.

skandragon avatar Jul 08 '20 19:07 skandragon

Actually it's not bid deal to update the Dockerfile with sed. But at least making uid/gid to be higher than 1000 (2000 for example) would make a life significantly easier.

northbear avatar Mar 19 '23 08:03 northbear