How to add PUID/PGID function into docker image?

Hi, For image build by linuxserver, it all build with function user define PUID/PGID, which could make docker image run without root privilege, recently I want to build a image by myself, but I didn’t found information how to write dockerfile to add PUID/PGID function, Could someone to share the knowledge about it? thanks!

You can have a look at the source code of our base images to find out how it is done. We use S6 for process control.
Or you can go the easy way, use our base images. Either the Ubuntu or alpine one.

saarg, thanks for your reply!

I checked the dockerfile of [docker-baseimage-alpine], it include

echo “**** create abc user and make our folders ****” &&
groupmod -g 1000 users &&
useradd -u 911 -U -d /config -s /bin/false abc &&
usermod -G users abc &&
mkdir -p
/app
/config
/defaults &&
mv /usr/bin/with-contenv /usr/bin/with-contenvb && \

Does it means it has defined the user in the docker image?

At the sametime, does it means I can use the docker-baseimage-alpine directly?

like create a new dockerfile:

FROM ghcr.io/linuxserver/docker-baseimage-alpine AS build
RUN apk add --no-cache redis git sed

But I tried, it reports:Error response from daemon: dockerfile parse error line 1: FROM requires either one or three arguments.

That means I made some mistake to pull the image? or something else.

See here: