1
0
mirror of https://github.com/docker-library/postgres.git synced 2025-07-26 23:21:10 +03:00
Commit Graph

83 Commits

Author SHA1 Message Date
25b3034e9b Update permissions from 777 to 1777
This still supports the "arbitrary user" use case but with slightly tighter permissions on the end result.

This one is a little bit more "special" other images (due to the existing runtime/entrypoint modification of the directory modes) so I've tried to pick reasonable values for both halves.
2023-03-10 16:05:33 -08:00
41bd7bf3f4 Add newline to POSTGRES_PASSWORD file for initdb
https://github.com/docker-library/postgres/issues/1024 converted all
`echo` calls to `printf`, but this change causes the password file
used by `initdb` to be blank rather than contain a single newline.
As a result, `initdb` will fail to start with an empty value with
the error:

```
initdb: error: password file "/dev/fd/63" is empty
```

`POSTGRES_PASSWORD` can be blank if `POSTGRES_HOST_AUTH_METHOD=trust`
is used. This change adds a newline to restore the original behavior.

Closes #1025
2022-12-22 13:40:11 -08:00
7e5e7ece73 Convert all entrypoint "echo"s to "printf"
The use of the `echo` shell built-in has been actively discouraged for a long time, but it's really convenient so we keep doing it.  This converts them all to use `printf` appropriately such that we avoid issues like `echo "$someVar"` from doing the wrong thing if `$someVar` is `-n` or similar.
2022-12-21 10:42:36 -08:00
74e51d102a prep for possible set -u in docker-entrypoint.sh
Update docker-entrypoint.sh
2022-06-16 15:11:37 -07:00
e8ebf74e50 Add .sql.zst support to docker-entrypoint-initdb.d 2022-03-04 17:28:24 -08:00
36abfddd6f Remove 9.6 (EOL)
See https://www.postgresql.org/about/news/postgresql-141-135-129-1114-1019-and-9624-released-2349/

> Additionally, this is the final release of PostgreSQL 9.6. If you are running PostgreSQL 9.6 in a production environment, we suggest that you make plans to upgrade.
2022-02-11 17:52:48 -08:00
a83005b407 Fix unset/cleanup "nss_wrapper" bits (#919)
original code didn't respect libnss-wrapper at other locations
2022-01-03 14:49:25 -08:00
edce986784 fix: Add --no-psqlrc to psql script invocations
This flag prevents custom .psqlrc files from interfering with the db init process
2021-10-23 21:54:12 +01:00
c6329e3bf2 Adjust POSTGRES_HOST_AUTH_METHOD to automatically match configured password_encryption 2021-10-15 14:52:26 -07:00
ab940cbb92 Fix "libnss-wrapper" usage on bullseye
See b9925a653a for the breaking change which necessitates this.
2021-09-28 10:57:41 -07:00
ba302205a1 Explicitly unset PGHOST for temporary server communications 2021-01-18 15:56:04 -08:00
03e769531f Merge pull request #801 from infosiftr/db-exists
Do not try to create databases that already exist
2020-12-28 14:39:40 -08:00
36ffea2cb2 Adjust "chmod" to not fail (since PostgreSQL validates this itself later) 2020-12-28 09:51:28 -08:00
11e397d86c Do not try to create databases that already exist
We were already checking for whether `POSTGRES_DB` was set to `postgres`, but this was the underlying motivation for that check (and it turns out that this applies for values of at least `template0` and `template1` as well).
2020-12-22 14:00:05 -08:00
fdf884a12f Fix typo 2020-09-06 18:17:09 +02:00
33bccfcadd Fix silently skipped init scripts 2020-02-28 16:01:52 -08:00
4f70bf2b81 Add .sql.xz support to docker-entrypoint-initdb.d
xzcat is provided by busybox in alpine
2020-02-17 15:38:43 -08:00
f1bc8782e7 Clarify that "POSTGRES_PASSWORD" should be non-empty
(Assuming "POSTGRES_HOST_AUTH_METHOD" is not set to the "trust" value which does not require passwords.)
2020-02-17 12:56:07 -08:00
46161d6ab3 Add missing -n's to bash test 2020-01-09 16:19:13 -08:00
42ce7437ee Error when POSTGRES_PASSWORD is unset like mysql
Add POSTGRES_HOST_AUTH_METHOD to bring back old behavior and be similar to MYSQL_ALLOW_EMPTY_PASSWORD, but add warning when "trust" is used since it disables all passwords
2020-01-09 16:19:02 -08:00
0d0485cb02 Merge pull request #647 from infosiftr/help
Check for "help" to short circuit server starting (since they break when passed to pg_ctl)
2019-12-03 09:43:18 -08:00
de2aa0bf56 Check for "help" to short circuit server starting (since they break when passed to pg_ctl) 2019-12-02 19:05:53 -08:00
89a2fb84e6 Update temporary server to prefer PGPORT if set (since the client and server both normally respect that variable) 2019-12-02 18:07:23 -08:00
b6a3881e30 typo fix 2019-11-26 15:54:18 -08:00
820323fa89 Adjust "docker_temp_server_start" to override port for consistent unix socket path 2019-11-25 17:15:02 -08:00
8fada98158 Fixes from tianon's review 2019-11-12 16:00:40 -08:00
d1cc08935c Improve _is_sourced check 2019-10-11 13:18:19 -07:00
6e85168bb0 Resync function interfaces with MySQL, improve comments
add `DATABASE_ALREADY_EXISTS` variable
2019-10-11 13:18:19 -07:00
2e70e7103e Apply function name changes as discussed in https://github.com/docker-library/mysql/pull/471 2019-10-11 13:18:19 -07:00
49fb87619b Namespace functions for less conflict when sourced 2019-10-11 13:18:19 -07:00
48f2ad1b73 Functionalize the entrypoint to allow outside sourcing for extreme customizing of startup 2019-10-11 13:18:19 -07:00
45b855af13 Warn on POSTGRES_PASSWORD of 100+ characters 2019-01-08 16:48:03 -08:00
3f585c58df Utilize "initdb" functionality better to allow "POSTGRES_INITDB_ARGS=--auth-local=md5"
This also closes a slight bug we've had previously where the "postgres" user is _always_ created (now we only create the user specified via the environment variables).
2018-09-06 13:49:43 -07:00
36294f464a Update psql invocations to properly escape user input!
See also:

- https://stackoverflow.com/a/18683163/433558
- https://www.postgresql.org/docs/9.3/static/app-psql.html#APP-PSQL-VARIABLES
- https://www.postgresql.org/docs/9.3/static/app-psql.html#APP-PSQL-INTERPOLATION
2018-08-24 11:22:17 -07:00
eff90effc6 Allow "initdb.d" scripts to be executed instead of sourced 2018-05-30 11:00:02 -07:00
fe89a60c9b Implement "nss_wrapper" for Debian variants 2018-05-24 11:39:50 -07:00
8b63de5f0c Update top-level entrypoint for #440 also 2018-05-10 09:41:57 -07:00
1805adb069 Postgres 10 renamed xlog to wal 2017-11-15 13:05:34 -08:00
c9c4089644 Update docker-entrypoint.sh
Improvement shebang
2017-07-25 01:06:21 +02:00
54053ad27a Adjust "/var/run/postgresql" permissions for arbitrary-user support 2017-05-19 10:46:58 -07:00
bc44222ff8 Add explicit "--build" to our "./configure" invocations 2017-05-10 10:19:28 -07:00
3d4e5e9f64 Simplify docker-entrypoint.sh append line 2017-04-06 14:32:45 -07:00
913bc48bfd Update order to match other blocks and move "--xlogdir" handling down to where it'll be invoked regardless of our "root" status 2017-03-20 09:54:06 -07:00
89530f6020 POSTGRES_INITDB_XLOGDIR to specify xlog log dir
Adds support for the POSTGRES_INITDB_XLOGDIR environment variable, which specifies where the postgres transaction log is stored.

For some use cases, being able to place the transaction log on a different volume is useful.

Existing support for providing flags via $POSTGRES_INITDB_ARGS is inadequate because of the need to create and chown/chmod the directory prior to running initdb.
2017-02-28 14:05:26 -08:00
d7accc9c8c Add one more minor tweak on top of #253 2017-01-19 16:04:43 -08:00
3706d4c456 Allow arbitrary --user values (mostly)
One special case is that `initdb` _requires_ the current user to exist in `/etc/passwd`, but running PostgreSQL itself does not require that.
2017-01-19 14:59:34 -08:00
b68154ed79 Use "/var/run/postgresql" consistently (and apply Debian's change of the default socket path to Alpine also) 2017-01-19 14:24:15 -08:00
e851d64ffc use -f flag when executing sql scripts 2016-12-11 07:26:29 +02:00
dfef790cd6 Update docker-entrypoint.sh
IPv6 default rule added into pg_hba.conf

The "all" keyword instead of the IP notation
2016-12-06 12:55:14 -08:00
edd455e5b1 Add "file_env" support, especially for Docker secrets
This adds explicit support for the following:

- `POSTGRES_DB_FILE`
- `POSTGRES_INITDB_ARGS_FILE`
- `POSTGRES_PASSWORD_FILE`
- `POSTGRES_USER_FILE`
2016-11-21 13:44:36 -08:00