How to create a database backup using docker-compose According to this documentation one could create a database backup

docker-compose.admin.yml

version: '3'
services:
  dbadmin:
    build: db_data/
    links:
      - db


running

docker-compose -f docker-compose.yml -f docker-compose.admin.yml \
run dbadmin db-backup


results initially in:

ERROR: Error processing tar file(archive/tar: invalid tar header): 


and when it is run for the second time:

ERROR: Error processing tar file(exit status 1): unexpected EOF
The number of downvotes on the link that is mentioned in the question could indicate that there are issues with the instructions.

Perhaps one could use native commands to backup the database. For example, this answer shows how to backup a postgres database that runs in docker using the pg_dump command.