You've already forked postgres
mirror of
https://github.com/docker-library/postgres.git
synced 2025-11-17 13:02:40 +03:00
Add postgres directory and user
This commit is contained in:
@@ -1,17 +1,13 @@
|
||||
# vim:set ft=dockerfile:
|
||||
FROM alpine:3.11
|
||||
|
||||
# alpine includes "postgres" user/group in base install
|
||||
# /etc/passwd:22:postgres:x:70:70::/var/lib/postgresql:/bin/sh
|
||||
# /etc/group:34:postgres:x:70:
|
||||
# the home directory for the postgres user, however, is not created by default
|
||||
# see https://github.com/docker-library/postgres/issues/274
|
||||
RUN set -ex; \
|
||||
postgresHome="$(getent passwd postgres)"; \
|
||||
postgresHome="$(echo "$postgresHome" | cut -d: -f6)"; \
|
||||
[ "$postgresHome" = '/var/lib/postgresql' ]; \
|
||||
mkdir -p "$postgresHome"; \
|
||||
chown -R postgres:postgres "$postgresHome"
|
||||
# 70 is the standard uid/gid for "postgres" in Alpine
|
||||
# https://git.alpinelinux.org/aports/tree/main/postgresql/postgresql.pre-install?h=3.11-stable
|
||||
RUN set -eux; \
|
||||
addgroup -g 70 -S postgres; \
|
||||
adduser -u 70 -S -D -G postgres postgres; \
|
||||
mkdir -p /var/lib/postgresql; \
|
||||
chown -R postgres:postgres /var/lib/postgresql
|
||||
|
||||
# su-exec (gosu-compatible) is installed further down
|
||||
|
||||
|
||||
Reference in New Issue
Block a user