

The intent is to prepend that script as the first argument to ENTRYPOINT which should cause Docker to infer UID and GID from a relevant bind mount.Īn environment variable "TEMPLATE" may be required to determine where the permissions should be inferred from. My entrypoint helper script can be found on GitHub. I discovered all of this while trying to write my own alternative to the fixuid project for running containers as the hosts UID/GID. addgroup BusyBox v1.28.4 ( 10:45:57 UTC) multi-call binary. If the GID corresponding to the provided UID already exists adduser will fail. One thing to note is that if -ingroup isn't set then the GID is assigned to match the UID. no-create-home Don't create home directory disabled-password Don't assign a password 1 Answer Sorted by: 156 Usually you do it like the following. The following long-form flags should work both in alpine as well as debian-derivatives: adduser BusyBox v1.28.4 ( 10:45:57 UTC) multi-call binary.
#REPLACE GID LINUX CODE#
The usage description for these applications is missing the long flags present in the code for adduser and addgroup. -no-create-home prevents cruft getting copied into the directory from /etc/skel.-home "$(pwd)" sets the user's home to the WORKDIR.

-gecos "" circumvents the prompt for "Full Name" etc.-disabled-password prevents prompt for a password.

Here's a template for Docker you can use in busybox environments (alpine) as well as Debian-based environments (Ubuntu, etc.): ENV USER=docker
