I am creating dumps on a dockerized PostgreSQL database on my server with following command:
docker exec -t postgres pg_dump -Fc -U mydb | gzip > $BACKUP_DIR/p