1- # [ Postgres 14.5 ] ( https://github.com/livingdocsIO/dockerfile-postgres ) [ ![ ] ( https://shields.beevelop.com/docker/pulls/livingdocs/postgres.svg?style=flat-square )] ( https://hub.docker.com/r/livingdocs/postgres )
1+ # [ Postgres 15.0 ] ( https://github.com/livingdocsIO/dockerfile-postgres ) [ ![ ] ( https://shields.beevelop.com/docker/pulls/livingdocs/postgres.svg?style=flat-square )] ( https://hub.docker.com/r/livingdocs/postgres )
22
33- Based on Debian
4- - Includes ` postgres-contrib ` , enables the extensions ` pg_stat_statements ` and ` pg_squeeze ` by default
4+ - Includes ` postgres-contrib ` , enables the extensions ` pg_stat_statements ` by default
55- Includes [ wal-g] ( https://github.com/wal-g/wal-g ) for WAL archiving and shipping
66- Includes [ pg_auto_failover] ( https://github.com/citusdata/pg_auto_failover ) for automatic failover
77- Runs as postgres user with uid (1000), gid (1000)
1313
1414``` bash
1515# Secured with a password, by default the image is secure
16- docker run -d --name postgres -p 5432:5432 -v postgres:/var/lib/postgresql -e POSTGRES_PASSWORD=somepassword livingdocs/postgres:14.5
16+ docker run -d --name postgres -p 5432:5432 -v postgres:/var/lib/postgresql -e POSTGRES_PASSWORD=somepassword livingdocs/postgres:15.0
1717```
1818
1919## Upgrade an existing postgres container
2020
2121``` bash
2222# Let's assume you've created a container previously
23- docker run -d --name postgres -p 5432:5432 -v postgres:/var/lib/postgresql livingdocs/postgres:13.4
23+ docker run -d --name postgres -p 5432:5432 -v postgres:/var/lib/postgresql livingdocs/postgres:14.5
2424
2525# First stop it, then run the upgrade image
2626docker stop postgres
27- docker run --rm -v postgres:/var/lib/postgresql livingdocs/postgres:14.5 -upgrade
27+ docker run --rm -v postgres:/var/lib/postgresql livingdocs/postgres:15.0 -upgrade
2828
2929# After it succeeds, you can run the new image and mount the existing volume
30- docker run -d --name postgres -p 5432:5432 -v postgres:/var/lib/postgresql livingdocs/postgres:14.5
30+ docker run -d --name postgres -p 5432:5432 -v postgres:/var/lib/postgresql livingdocs/postgres:15.0
3131```
3232
3333## To build this image manually
3434
3535``` bash
36- docker build -t livingdocs/postgres:14.5 .
36+ docker build -t livingdocs/postgres:15.0 .
3737
3838# To build and push the multi-arch manifest to docker hub
39- docker buildx build --platform linux/amd64,linux/arm64 -t livingdocs/postgres:14.5 --push .
40- docker buildx build --platform linux/amd64,linux/arm64 -t livingdocs/postgres:14.5 -upgrade --push -f Dockerfile.upgrade .
39+ docker buildx build --platform linux/amd64,linux/arm64 -t livingdocs/postgres:15.0 --push .
40+ docker buildx build --platform linux/amd64,linux/arm64 -t livingdocs/postgres:15.0 -upgrade --push -f Dockerfile.upgrade .
4141```
4242
4343## Set up streaming replication
4444
4545### Simple setup
4646``` bash
4747# Create the containers
48- docker run -d -p 5433:5432 --name postgres-1 livingdocs/postgres:14.5
49- docker run -d -p 5434:5432 --name postgres-2 livingdocs/postgres:14.5 standby -d " host=host.docker.internal port=5433 user=postgres target_session_attrs=read-write"
48+ docker run -d -p 5433:5432 --name postgres-1 livingdocs/postgres:15.0
49+ docker run -d -p 5434:5432 --name postgres-2 livingdocs/postgres:15.0 standby -d " host=host.docker.internal port=5433 user=postgres target_session_attrs=read-write"
5050
5151# Test the replication
5252docker exec postgres-1 psql -c " CREATE TABLE hello (value text); INSERT INTO hello(value) VALUES('world');"
@@ -64,7 +64,7 @@ docker exec postgres-2 psql -c "SELECT * FROM hello;"
6464docker network create local
6565
6666# First create the database primary
67- docker run -d -p 5433:5432 --name postgres-1 --network=local --network-alias=postgres -e POSTGRES_HOST_AUTH_METHOD=md5 livingdocs/postgres:14.5
67+ docker run -d -p 5433:5432 --name postgres-1 --network=local --network-alias=postgres -e POSTGRES_HOST_AUTH_METHOD=md5 livingdocs/postgres:15.0
6868
6969# Create the users on database intialization
7070# You could also mount an sql or script into /var/lib/postgresql/initdb.d during cluster startup to execute the script automatically.
@@ -73,8 +73,8 @@ docker exec postgres-1 psql -c "CREATE USER replication REPLICATION LOGIN ENCRYP
7373
7474# The launch the replicas
7575export DB_URL=" host=postgres port=5432 user=replication password=some-replication-password target_session_attrs=read-write"
76- docker run -d -p 5434:5432 --name postgres-2 --network=local --network-alias=postgres livingdocs/postgres:14.5 standby -d $DB_URL
77- docker run -d -p 5435:5432 --name postgres-3 --network=local --network-alias=postgres livingdocs/postgres:14.5 standby -d $DB_URL
76+ docker run -d -p 5434:5432 --name postgres-2 --network=local --network-alias=postgres livingdocs/postgres:15.0 standby -d $DB_URL
77+ docker run -d -p 5435:5432 --name postgres-3 --network=local --network-alias=postgres livingdocs/postgres:15.0 standby -d $DB_URL
7878
7979# Test the replication
8080docker exec postgres-1 psql -c " CREATE TABLE hello (value text); INSERT INTO hello(value) VALUES('hello');"
0 commit comments