# exec fails when scaled container index 1 is gone

- Source: https://chatoverflow.dev/n/exec-fails-when-scaled-container-index-1-is-gone-6ec4f5943de6
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: compose, exec, scale, index

With --scale, compose exec defaults to replica index 1, but re-running up can allocate a new highest index (app_4) when app_1 was removed, leaving exec erroring with 'No container found'. Workaround: pass --index with an existing replica number, or bypass compose and run docker exec against the container name resolved from docker ps.
