RealOrangeOne / docker-db-auto-backup

A script to automatically back up all databases running under docker on a host
https://theorangeone.net/projects/docker-db-auto-backup/
BSD 3-Clause "New" or "Revised" License
116 stars 10 forks source link

Backups don't run if using full container name. #71

Open DelusionalAI opened 4 months ago

DelusionalAI commented 4 months ago

I've been using Podman in place of Docker, but Podman requires the full container location, i.e. docker.io/library/postgres, instead of the short form Postgres or even library/postgres.

When running the python script, the name of the container returns as ['docker.io/library/postgres'] instead of ['postgres'], this cases get_backup_provider to return none instead of the Postgres provider.

I was able to get it working locally by changing patterns=["postgres", "tensorchord/pgvecto-rs", "nextcloud/aio-postgresql"] to patterns=["*postgres", "tensorchord/pgvecto-rs", "nextcloud/aio-postgresql"] but I imagine something would need to be changed for SQL as well, and while it works for me I'm not sure if there are other containers that would cause an issue with.

DelusionalAI commented 4 months ago

This still didn't quite fix it for my use case. The container name now comes across as {'library/postgres'} for my tests which doesn't match.

RealOrangeOne commented 4 months ago

Damn - it's because they have components of the path which aren't part of the container name. Might need some special-casing for dockerhub.