Where can I configure the start user UID for Docke

2019-07-17 06:40发布

问题:

Where can I configure the start user UID for Docker containers? By default it uses UID 999 which conflicts with some other users on my system.

回答1:

In your Dockerfile, run the following command:

RUN groupadd -r -g 1234 newusername && useradd -r -u 1234 -g newusername newusername
USER newusername

This will create a user newusername with GID 1234 and UID 1234, then run the container with a default user newusername.