Postgres Wal G Docker Image
该镜像扩展官方PostgreSQL镜像,集成WAL-G工具及辅助脚本,支持将Postgres数据库加密备份至S3兼容存储,并提供便捷的恢复功能。
Postgres WAL-G
This image extends the stock https://hub.docker.com/_/postgres/ and adds https://github.com/wal-g/wal-g support, along with some helpful scripts. It allows you to simply and easily create continuous, encrypted archives of Postgres databases in S3-compatible storage.
Source
The source code is available here.
Environment
To use the image, you'll need to configure a bucket on your favorite S3- compatible provider, and set a few environment variables:
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYthat can read/write files to your bucketAWS_ENDPOINT(et al) to tell WAL-G where to archive (see https://github.com/wal-g/wal-g/blob/master/docs/PostgreSQL.md for details)WALG_S3_PREFIXto tell WAL-G which bucket and prefix you'd like to useWALG_LIBSODIUM_KEYto encrypt the files stored in S3
Configuration
In your /var/lib/postgresql/data/pgsql/postgresql.conf file, set your https://www.postgresql.org/docs/current/continuous-archiving.html.
Importantly, you should set archive_mode = on and
archive_command = 'wal-g wal-push %p'. This will
tell Postgres to have WAL-G send WAL files to S3.
Full Backups
To run a full backup, simply run /wal-g/backup.sh.
Continuous Backups
These will happen automatically once you've started Postgres with your edited
postgresql.conf file (see
Configuration, above).
Recovery
Testing recovery is simple: run a new Docker container with the correct
environment variables set and run /wal-g/recover.sh. It will:
- Recover from the most recent full backup
- Configure Postgres to not accept incoming connections or perform streaming backups until the recovery is complete (important for testing!)
- Configure Postgres to apply all the WAL files
- Shut down Postgres, re-enable incoming connections and streaming backups
At this point you should have high confidence that the recovery was successful.
If you start your recovered backup, be sure to turn archive_mode = off to avoid
pushing additional WAL files to S3!
Postgres Versions
Currently I build for Postgres 17, but you can build for whatever version that wal-g supports.
koehn 命名空间的其他可用镜像:
镜像拉取方式
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
轩辕镜像加速拉取命令点我查看更多 postgres-wal-g 镜像标签
DockerHub 原生拉取命令
用户好评
来自真实用户的反馈,见证轩辕镜像的优质服务