-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update postgres #9356
Merged
Merged
Update postgres #9356
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Changes: - docker-library/postgres@03e7695: Merge pull request docker-library/postgres#801 from infosiftr/db-exists - docker-library/postgres@eaeb73d: Merge pull request docker-library/postgres#804 from infosiftr/chmod-no-fail - docker-library/postgres@36ffea2: Adjust "chmod" to not fail (since PostgreSQL validates this itself later) - docker-library/postgres@11e397d: Do not try to create databases that already exist - docker-library/postgres@3690694: Merge pull request docker-library/postgres#797 from infosiftr/rc-beta-alpha - docker-library/postgres@dba8ec0: Adjust tagging to enforce explicit pre-release opt-in
Diff for 2414074:diff --git a/_bashbrew-cat b/_bashbrew-cat
index 92f7f4c..7ec03de 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -3,60 +3,60 @@ GitRepo: https://github.com/docker-library/postgres.git
Tags: 9.5.24, 9.5
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386
-GitCommit: ab0af9c5d95663d33880bbb95eb9d5d188469abf
+GitCommit: 03e769531fff4c97cb755e4a608b24935ceeee27
Directory: 9.5
Tags: 9.5.24-alpine, 9.5-alpine
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 6b541bc498a02875a81a6ce6e4016ea956171205
+GitCommit: 03e769531fff4c97cb755e4a608b24935ceeee27
Directory: 9.5/alpine
Tags: 9.6.20, 9.6, 9
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386
-GitCommit: c438d9e7bb9f610e7e599ee328832ed98bc0595f
+GitCommit: 03e769531fff4c97cb755e4a608b24935ceeee27
Directory: 9.6
Tags: 9.6.20-alpine, 9.6-alpine, 9-alpine
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 0e4676a9bce5f67ec9c3758b2bfa2ff35aec07e6
+GitCommit: 03e769531fff4c97cb755e4a608b24935ceeee27
Directory: 9.6/alpine
Tags: 10.15, 10
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386
-GitCommit: 0e903779e979b4cae597f5dfc97fb3eb9d6d77e8
+GitCommit: 03e769531fff4c97cb755e4a608b24935ceeee27
Directory: 10
Tags: 10.15-alpine, 10-alpine
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 92d7a789c6c8667105894f358eaf50a4b448875a
+GitCommit: 03e769531fff4c97cb755e4a608b24935ceeee27
Directory: 10/alpine
Tags: 11.10, 11
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386
-GitCommit: 38841304ddd06dd3b39cc080b2c8fce5a5be8e52
+GitCommit: 03e769531fff4c97cb755e4a608b24935ceeee27
Directory: 11
Tags: 11.10-alpine, 11-alpine
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 1dcdff4b410936b5b11d1e25c6b60a002b2fc9b9
+GitCommit: 03e769531fff4c97cb755e4a608b24935ceeee27
Directory: 11/alpine
Tags: 12.5, 12
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: b17c1440572a0922ed65eb84392b33fd44171ddd
+GitCommit: 03e769531fff4c97cb755e4a608b24935ceeee27
Directory: 12
Tags: 12.5-alpine, 12-alpine
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 6f58eab268f60c9dfcfe8a7e3fba7499f239236b
+GitCommit: 03e769531fff4c97cb755e4a608b24935ceeee27
Directory: 12/alpine
Tags: 13.1, 13, latest
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 25044882a65cdd16e20e317c942d4e9109708d81
+GitCommit: 03e769531fff4c97cb755e4a608b24935ceeee27
Directory: 13
Tags: 13.1-alpine, 13-alpine, alpine
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: b9c080857b880202ebd23c59d33fe86d7a70fea3
+GitCommit: 03e769531fff4c97cb755e4a608b24935ceeee27
Directory: 13/alpine
diff --git a/postgres_10-alpine/docker-entrypoint.sh b/postgres_10-alpine/docker-entrypoint.sh
index 72cdc53..0bb571c 100755
--- a/postgres_10-alpine/docker-entrypoint.sh
+++ b/postgres_10-alpine/docker-entrypoint.sh
@@ -37,7 +37,8 @@ docker_create_db_directories() {
local user; user="$(id -u)"
mkdir -p "$PGDATA"
- chmod 700 "$PGDATA"
+ # ignore failure since there are cases where we can't chmod (and PostgreSQL might fail later anyhow - it's picky about permissions of this directory)
+ chmod 700 "$PGDATA" || :
# ignore failure since it will be fine when using the image provided directory; see also https://github.com/docker-library/postgres/pull/289
mkdir -p /var/run/postgresql || :
@@ -188,7 +189,13 @@ docker_process_sql() {
# create initial database
# uses environment variables for input: POSTGRES_DB
docker_setup_db() {
- if [ "$POSTGRES_DB" != 'postgres' ]; then
+ local dbAlreadyExists
+ dbAlreadyExists="$(
+ POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" --tuples-only <<-'EOSQL'
+ SELECT 1 FROM pg_database WHERE datname = :'db' ;
+ EOSQL
+ )"
+ if [ -z "$dbAlreadyExists" ]; then
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
diff --git a/postgres_10/docker-entrypoint.sh b/postgres_10/docker-entrypoint.sh
index 51d871b..aeff591 100755
--- a/postgres_10/docker-entrypoint.sh
+++ b/postgres_10/docker-entrypoint.sh
@@ -37,7 +37,8 @@ docker_create_db_directories() {
local user; user="$(id -u)"
mkdir -p "$PGDATA"
- chmod 700 "$PGDATA"
+ # ignore failure since there are cases where we can't chmod (and PostgreSQL might fail later anyhow - it's picky about permissions of this directory)
+ chmod 700 "$PGDATA" || :
# ignore failure since it will be fine when using the image provided directory; see also https://github.com/docker-library/postgres/pull/289
mkdir -p /var/run/postgresql || :
@@ -188,7 +189,13 @@ docker_process_sql() {
# create initial database
# uses environment variables for input: POSTGRES_DB
docker_setup_db() {
- if [ "$POSTGRES_DB" != 'postgres' ]; then
+ local dbAlreadyExists
+ dbAlreadyExists="$(
+ POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" --tuples-only <<-'EOSQL'
+ SELECT 1 FROM pg_database WHERE datname = :'db' ;
+ EOSQL
+ )"
+ if [ -z "$dbAlreadyExists" ]; then
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
diff --git a/postgres_11-alpine/docker-entrypoint.sh b/postgres_11-alpine/docker-entrypoint.sh
index 72cdc53..0bb571c 100755
--- a/postgres_11-alpine/docker-entrypoint.sh
+++ b/postgres_11-alpine/docker-entrypoint.sh
@@ -37,7 +37,8 @@ docker_create_db_directories() {
local user; user="$(id -u)"
mkdir -p "$PGDATA"
- chmod 700 "$PGDATA"
+ # ignore failure since there are cases where we can't chmod (and PostgreSQL might fail later anyhow - it's picky about permissions of this directory)
+ chmod 700 "$PGDATA" || :
# ignore failure since it will be fine when using the image provided directory; see also https://github.com/docker-library/postgres/pull/289
mkdir -p /var/run/postgresql || :
@@ -188,7 +189,13 @@ docker_process_sql() {
# create initial database
# uses environment variables for input: POSTGRES_DB
docker_setup_db() {
- if [ "$POSTGRES_DB" != 'postgres' ]; then
+ local dbAlreadyExists
+ dbAlreadyExists="$(
+ POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" --tuples-only <<-'EOSQL'
+ SELECT 1 FROM pg_database WHERE datname = :'db' ;
+ EOSQL
+ )"
+ if [ -z "$dbAlreadyExists" ]; then
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
diff --git a/postgres_11/docker-entrypoint.sh b/postgres_11/docker-entrypoint.sh
index 51d871b..aeff591 100755
--- a/postgres_11/docker-entrypoint.sh
+++ b/postgres_11/docker-entrypoint.sh
@@ -37,7 +37,8 @@ docker_create_db_directories() {
local user; user="$(id -u)"
mkdir -p "$PGDATA"
- chmod 700 "$PGDATA"
+ # ignore failure since there are cases where we can't chmod (and PostgreSQL might fail later anyhow - it's picky about permissions of this directory)
+ chmod 700 "$PGDATA" || :
# ignore failure since it will be fine when using the image provided directory; see also https://github.com/docker-library/postgres/pull/289
mkdir -p /var/run/postgresql || :
@@ -188,7 +189,13 @@ docker_process_sql() {
# create initial database
# uses environment variables for input: POSTGRES_DB
docker_setup_db() {
- if [ "$POSTGRES_DB" != 'postgres' ]; then
+ local dbAlreadyExists
+ dbAlreadyExists="$(
+ POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" --tuples-only <<-'EOSQL'
+ SELECT 1 FROM pg_database WHERE datname = :'db' ;
+ EOSQL
+ )"
+ if [ -z "$dbAlreadyExists" ]; then
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
diff --git a/postgres_12-alpine/docker-entrypoint.sh b/postgres_12-alpine/docker-entrypoint.sh
index 72cdc53..0bb571c 100755
--- a/postgres_12-alpine/docker-entrypoint.sh
+++ b/postgres_12-alpine/docker-entrypoint.sh
@@ -37,7 +37,8 @@ docker_create_db_directories() {
local user; user="$(id -u)"
mkdir -p "$PGDATA"
- chmod 700 "$PGDATA"
+ # ignore failure since there are cases where we can't chmod (and PostgreSQL might fail later anyhow - it's picky about permissions of this directory)
+ chmod 700 "$PGDATA" || :
# ignore failure since it will be fine when using the image provided directory; see also https://github.com/docker-library/postgres/pull/289
mkdir -p /var/run/postgresql || :
@@ -188,7 +189,13 @@ docker_process_sql() {
# create initial database
# uses environment variables for input: POSTGRES_DB
docker_setup_db() {
- if [ "$POSTGRES_DB" != 'postgres' ]; then
+ local dbAlreadyExists
+ dbAlreadyExists="$(
+ POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" --tuples-only <<-'EOSQL'
+ SELECT 1 FROM pg_database WHERE datname = :'db' ;
+ EOSQL
+ )"
+ if [ -z "$dbAlreadyExists" ]; then
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
diff --git a/postgres_12/docker-entrypoint.sh b/postgres_12/docker-entrypoint.sh
index 51d871b..aeff591 100755
--- a/postgres_12/docker-entrypoint.sh
+++ b/postgres_12/docker-entrypoint.sh
@@ -37,7 +37,8 @@ docker_create_db_directories() {
local user; user="$(id -u)"
mkdir -p "$PGDATA"
- chmod 700 "$PGDATA"
+ # ignore failure since there are cases where we can't chmod (and PostgreSQL might fail later anyhow - it's picky about permissions of this directory)
+ chmod 700 "$PGDATA" || :
# ignore failure since it will be fine when using the image provided directory; see also https://github.com/docker-library/postgres/pull/289
mkdir -p /var/run/postgresql || :
@@ -188,7 +189,13 @@ docker_process_sql() {
# create initial database
# uses environment variables for input: POSTGRES_DB
docker_setup_db() {
- if [ "$POSTGRES_DB" != 'postgres' ]; then
+ local dbAlreadyExists
+ dbAlreadyExists="$(
+ POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" --tuples-only <<-'EOSQL'
+ SELECT 1 FROM pg_database WHERE datname = :'db' ;
+ EOSQL
+ )"
+ if [ -z "$dbAlreadyExists" ]; then
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
diff --git a/postgres_9-alpine/docker-entrypoint.sh b/postgres_9-alpine/docker-entrypoint.sh
index 0e0e2e9..8c57b63 100755
--- a/postgres_9-alpine/docker-entrypoint.sh
+++ b/postgres_9-alpine/docker-entrypoint.sh
@@ -37,7 +37,8 @@ docker_create_db_directories() {
local user; user="$(id -u)"
mkdir -p "$PGDATA"
- chmod 700 "$PGDATA"
+ # ignore failure since there are cases where we can't chmod (and PostgreSQL might fail later anyhow - it's picky about permissions of this directory)
+ chmod 700 "$PGDATA" || :
# ignore failure since it will be fine when using the image provided directory; see also https://github.com/docker-library/postgres/pull/289
mkdir -p /var/run/postgresql || :
@@ -188,7 +189,13 @@ docker_process_sql() {
# create initial database
# uses environment variables for input: POSTGRES_DB
docker_setup_db() {
- if [ "$POSTGRES_DB" != 'postgres' ]; then
+ local dbAlreadyExists
+ dbAlreadyExists="$(
+ POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" --tuples-only <<-'EOSQL'
+ SELECT 1 FROM pg_database WHERE datname = :'db' ;
+ EOSQL
+ )"
+ if [ -z "$dbAlreadyExists" ]; then
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
diff --git a/postgres_9.5-alpine/docker-entrypoint.sh b/postgres_9.5-alpine/docker-entrypoint.sh
index 0e0e2e9..8c57b63 100755
--- a/postgres_9.5-alpine/docker-entrypoint.sh
+++ b/postgres_9.5-alpine/docker-entrypoint.sh
@@ -37,7 +37,8 @@ docker_create_db_directories() {
local user; user="$(id -u)"
mkdir -p "$PGDATA"
- chmod 700 "$PGDATA"
+ # ignore failure since there are cases where we can't chmod (and PostgreSQL might fail later anyhow - it's picky about permissions of this directory)
+ chmod 700 "$PGDATA" || :
# ignore failure since it will be fine when using the image provided directory; see also https://github.com/docker-library/postgres/pull/289
mkdir -p /var/run/postgresql || :
@@ -188,7 +189,13 @@ docker_process_sql() {
# create initial database
# uses environment variables for input: POSTGRES_DB
docker_setup_db() {
- if [ "$POSTGRES_DB" != 'postgres' ]; then
+ local dbAlreadyExists
+ dbAlreadyExists="$(
+ POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" --tuples-only <<-'EOSQL'
+ SELECT 1 FROM pg_database WHERE datname = :'db' ;
+ EOSQL
+ )"
+ if [ -z "$dbAlreadyExists" ]; then
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
diff --git a/postgres_9.5/docker-entrypoint.sh b/postgres_9.5/docker-entrypoint.sh
index 4937470..c49ad0d 100755
--- a/postgres_9.5/docker-entrypoint.sh
+++ b/postgres_9.5/docker-entrypoint.sh
@@ -37,7 +37,8 @@ docker_create_db_directories() {
local user; user="$(id -u)"
mkdir -p "$PGDATA"
- chmod 700 "$PGDATA"
+ # ignore failure since there are cases where we can't chmod (and PostgreSQL might fail later anyhow - it's picky about permissions of this directory)
+ chmod 700 "$PGDATA" || :
# ignore failure since it will be fine when using the image provided directory; see also https://github.com/docker-library/postgres/pull/289
mkdir -p /var/run/postgresql || :
@@ -188,7 +189,13 @@ docker_process_sql() {
# create initial database
# uses environment variables for input: POSTGRES_DB
docker_setup_db() {
- if [ "$POSTGRES_DB" != 'postgres' ]; then
+ local dbAlreadyExists
+ dbAlreadyExists="$(
+ POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" --tuples-only <<-'EOSQL'
+ SELECT 1 FROM pg_database WHERE datname = :'db' ;
+ EOSQL
+ )"
+ if [ -z "$dbAlreadyExists" ]; then
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
diff --git a/postgres_9/docker-entrypoint.sh b/postgres_9/docker-entrypoint.sh
index 4937470..c49ad0d 100755
--- a/postgres_9/docker-entrypoint.sh
+++ b/postgres_9/docker-entrypoint.sh
@@ -37,7 +37,8 @@ docker_create_db_directories() {
local user; user="$(id -u)"
mkdir -p "$PGDATA"
- chmod 700 "$PGDATA"
+ # ignore failure since there are cases where we can't chmod (and PostgreSQL might fail later anyhow - it's picky about permissions of this directory)
+ chmod 700 "$PGDATA" || :
# ignore failure since it will be fine when using the image provided directory; see also https://github.com/docker-library/postgres/pull/289
mkdir -p /var/run/postgresql || :
@@ -188,7 +189,13 @@ docker_process_sql() {
# create initial database
# uses environment variables for input: POSTGRES_DB
docker_setup_db() {
- if [ "$POSTGRES_DB" != 'postgres' ]; then
+ local dbAlreadyExists
+ dbAlreadyExists="$(
+ POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" --tuples-only <<-'EOSQL'
+ SELECT 1 FROM pg_database WHERE datname = :'db' ;
+ EOSQL
+ )"
+ if [ -z "$dbAlreadyExists" ]; then
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
diff --git a/postgres_alpine/docker-entrypoint.sh b/postgres_alpine/docker-entrypoint.sh
index 72cdc53..0bb571c 100755
--- a/postgres_alpine/docker-entrypoint.sh
+++ b/postgres_alpine/docker-entrypoint.sh
@@ -37,7 +37,8 @@ docker_create_db_directories() {
local user; user="$(id -u)"
mkdir -p "$PGDATA"
- chmod 700 "$PGDATA"
+ # ignore failure since there are cases where we can't chmod (and PostgreSQL might fail later anyhow - it's picky about permissions of this directory)
+ chmod 700 "$PGDATA" || :
# ignore failure since it will be fine when using the image provided directory; see also https://github.com/docker-library/postgres/pull/289
mkdir -p /var/run/postgresql || :
@@ -188,7 +189,13 @@ docker_process_sql() {
# create initial database
# uses environment variables for input: POSTGRES_DB
docker_setup_db() {
- if [ "$POSTGRES_DB" != 'postgres' ]; then
+ local dbAlreadyExists
+ dbAlreadyExists="$(
+ POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" --tuples-only <<-'EOSQL'
+ SELECT 1 FROM pg_database WHERE datname = :'db' ;
+ EOSQL
+ )"
+ if [ -z "$dbAlreadyExists" ]; then
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
diff --git a/postgres_latest/docker-entrypoint.sh b/postgres_latest/docker-entrypoint.sh
index 51d871b..aeff591 100755
--- a/postgres_latest/docker-entrypoint.sh
+++ b/postgres_latest/docker-entrypoint.sh
@@ -37,7 +37,8 @@ docker_create_db_directories() {
local user; user="$(id -u)"
mkdir -p "$PGDATA"
- chmod 700 "$PGDATA"
+ # ignore failure since there are cases where we can't chmod (and PostgreSQL might fail later anyhow - it's picky about permissions of this directory)
+ chmod 700 "$PGDATA" || :
# ignore failure since it will be fine when using the image provided directory; see also https://github.com/docker-library/postgres/pull/289
mkdir -p /var/run/postgresql || :
@@ -188,7 +189,13 @@ docker_process_sql() {
# create initial database
# uses environment variables for input: POSTGRES_DB
docker_setup_db() {
- if [ "$POSTGRES_DB" != 'postgres' ]; then
+ local dbAlreadyExists
+ dbAlreadyExists="$(
+ POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" --tuples-only <<-'EOSQL'
+ SELECT 1 FROM pg_database WHERE datname = :'db' ;
+ EOSQL
+ )"
+ if [ -z "$dbAlreadyExists" ]; then
POSTGRES_DB= docker_process_sql --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
CREATE DATABASE :"db" ;
EOSQL
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes: