chusri/postgres-client-awscli:alpine-3.21-pg17Minimal Docker image based on Alpine 3.21 containing:
psql)Perfect for database operations, backup, and restore tasks in Kubernetes CronJobs, CI/CD pipelines, and scripting environments.
| Tool | Version |
|---|---|
| Alpine Linux | 3.21 |
| PostgreSQL Client | 17.x |
| AWS CLI | v2.x |
docker pull chusri/postgres-client-awscli:alpine-3.21-pg17
Connect to a PostgreSQL database
docker run --rm chusri/postgres-client-awscli:alpine-3.21-pg17 \
psql -h your-db-hostname -U your-username -d your-database
Backup a PostgreSQL database to a file
docker run --rm -v $(pwd):/backup chusri/postgres-client-awscli:alpine-3.21-pg17 \
pg_dump -h your-db-hostname -U your-username your-database > /backup/backup.sql
Upload backup to S3
docker run --rm -v $(pwd):/backup chusri/postgres-client-awscli:alpine-3.21-pg17 \
aws s3 cp /backup/backup.sql s3://your-bucket-name/path/to/backup.sql
apiVersion: batch/v1
kind: CronJob
metadata:
name: postgres-backup
spec:
schedule: "0 2 * * *" # every day at 2AM
jobTemplate:
spec:
template:
spec:
containers:
- name: backup
image: chusri/postgres-client-awscli:alpine-3.21-pg17
command: ["/bin/sh", "-c"]
args:
- |
pg_dump -h your-db-host -U your-user your-db > /backup/backup.sql &&
aws s3 cp /backup/backup.sql s3://your-bucket-name/path/to/backup.sql
env:
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: aws-secret
key: accessKeyId
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: aws-secret
key: secretAccessKey
restartPolicy: OnFailure
This project is licensed under the MIT License. See the LICENSE file for details.
Content type
Image
Digest
sha256:13c3bc3b8…
Size
51.7 MB
Last updated
over 1 year ago
docker pull chusri/postgres-client-awscli