docker-nexus3
docker-nexus3 copied to clipboard
[NEXUS-14427] Usage of the UID via environment
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
+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...).
+1
Since we moved to the UBI doesn’t it run as a random uid??
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 I'm against having this being a build arg, makes it impossible to just change it for different container-instances.
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?
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.
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.
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.