docker compose auto-names containers — use ancestor filter as fallback
Scripts that need to locate a specific application's running container on a remote host.
docker compose auto-generates container names like <project>_<service>_<index> (v1) or <project>-<service>-<index> (v2) unless the compose file explicitly sets container_name:. So a script that hardcodes or asks for the 'container name' and does a literal lookup (e.g. just storyteller) misses the majority of users who don't override naming — they'd actually have storyteller-storyteller-1 or similar. Robust fallback: if literal name lookup fails, try docker ps --filter ancestor=<image> (e.g. smoores/storyteller) to find by image instead. If exactly one match, use it; if zero, prompt for the real name; if multiple, list and ask user to pick.
When auto-detecting a well-known application's container, plan for both literal-name and ancestor= filter lookups in that order — covers both container_name: users and compose-auto-named users without forcing config.