#5524·dokploy

Database backups require gzip/shell inside the DB container, breaking hardened images (e.g. Docker Hardened Images)

Author: KyleAESICreated Sep 25, 2026Updated Sep 29, 2026
Labelsenhancement

What problem will this feature address?

Postgres/MySQL/MariaDB backups execute <dump> | gzip inside the database container via docker exec ... bash -c. Hardened/minimal images (DHI, distroless, Chainguard) intentionally ship without gzip, a package manager, or sometimes a shell, so backups fail. The only workarounds if you want to leverage the built-in backup feature are to add gzip to the image or install it at container start, both of which weaken the hardening.

Describe the solution you'd like

  1. Run only the dump binary in the container and do compression on the Dokploy host: docker exec -e PGPASSWORD=... <c> pg_dump -Fc ... | gzip | rclone rcat .... The output format doesn't change, so it's backward compatible.
  2. Exec the dump binary directly (argv form), not via bash -c.
  3. Optional: a compression setting (gzip / none / native pg_dump --compress), since -Fc is already compressed.
  4. Mirror this in restore: decompress on the host and stream to docker exec -i <c> pg_restore ....

Describe alternatives you've considered

Tested workaround on 18-debian-dev which includes apt-get. Used the Command/Args to have gzip installed at startup via base -c apt-get update && apt-get install -y gzip && exec docker-entrypoint.sh

This works but again, defeats the purpose of using a hardened image by needing to use the -dev with more CVEs and also installing gzip on each redeploy. Many reason why gzip is not included in even the -dev version of this secure container.

Additional context

Tested on Dokploy v0.30.6 with dhi.io/postgres:18-debian image

Will you send a PR to implement it?

Maybe, need help