Note
With the latest pricing and subscription changes by Docker there's no longer unlimited free storage and thus this project is kinda pointless. You should probably just upload your backup on an S3(-compatible) bucket :)
Have you ever looked for a cheap solution to store a database backup somewhere safe and you didn't want to bother with an S3-compatible cloud storage?
Look no further, because there is BockeR.
BockeR is a command line tool which creates a backup from a PostgreSQL database, wraps it in a Docker image, and uploads it to Docker Hub. Of course, BockeR will also do the reverse and restore your database from a backup in Docker Hub.
Is it a good idea? Probably not, but it solved a problem I had!
Warning
Do not push the image to a public repository, or everybody in the world will have access to your database backup!
Linux and macOS binaries are available in Homebrew:
brew install bueti/tap/bockerOr brew tap bueti/tap and then brew install bocker.
Download the appropriate file from the Releases page, unpack the file and put the binary in your PATH.
To configure your username and password run:
bocker config setIf you want to run bocker on server where there's no keyring tool installed, set the following environment variables:
export DOCKER_USERNAME=<your docker username>
export DOCKER_PASSWORD=<your docker password>bocker will prefer environment variables over the keyring.
To inspect the stored configuration:
bocker config list # shows the username; password is hidden
bocker config list --show-password # also prints the stored passwordTo list existing backups you need to tell bocker for which namespace and repository you want to list tags:
bocker backup list -n <namespace> -r <repository>bocker restore -r greenlight_backup -o postgres -s greenlight -t greenlight_test --tag 2023-02-14_21-11-43Run bocker restore -h for the full list of flags.
For the host path (no --container-id), pg_dump / pg_restore / psql inherit the caller's environment, so setting PGPASSWORD (or having a ~/.pgpass) before running bocker works as usual.
When --container-id is set, bocker runs the Postgres tools inside the container via docker exec. If PGPASSWORD is exported in your shell, it is forwarded with docker exec -e PGPASSWORD so the value stays off argv.
Ctrl+C cancels the in-flight operation — the Docker push, the image pull, or the running pg_* subprocess — instead of letting them finish.
There are some assumptions made:
- The host you are running
bockerhas Docker installed docker loginwas run successfully and you must have permission to push images- You need a Docker Hub Personal Access Token which requires the following permissions:
Read, Write, Delete
Use -h to get help for each subcommand:
bocker --help
bocker backup --help
bocker restore --help

