Skip to content

Commit a4091be

Browse files
authored
Update Dockerfile
Adding personalized UID and GID for postgress user
1 parent 14f13e4 commit a4091be

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

13/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@ RUN set -ex; \
1111
rm -rf /var/lib/apt/lists/*; \
1212
fi
1313

14+
ENV PUID 1101
15+
ENV PGID 1101
16+
ARG PUID=1101
17+
ARG PGID=1101
18+
1419
# explicitly set user/group IDs
1520
RUN set -eux; \
16-
groupadd -r postgres --gid=999; \
21+
groupadd -r postgres --gid=${PGID}; \
1722
# https://salsa.debian.org/postgresql/postgresql-common/blob/997d842ee744687d99a2b2d95c1083a2615c79e8/debian/postgresql-common.postinst#L32-35
18-
useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
23+
useradd -r -g postgres --uid=${PUID} --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
1924
# also create the postgres user's home directory with appropriate permissions
2025
# see https://github.com/docker-library/postgres/issues/274
2126
mkdir -p /var/lib/postgresql; \

0 commit comments

Comments
 (0)