fix(ecr): follow the registry when deleting the last repository replaces it (#7224)

In memory mode, or with prune-volumes-on-delete, deleting the last repository
removes the backing registry container and the next CreateRepository starts a
new one. Floci running in Docker reached the registry by container name, so
when the new container got a different IP the JVM's cached lookup kept
answering with the old address. Until it expired, DeleteRepository returned
500 and CreateRepository could wait long enough for the SDK to time out and
retry, which then failed with RepositoryAlreadyExistsException.

Use the address Docker reports for the container just started or adopted,
and only fall back to the name when none is known. EcrTest no longer needs to
keep a repository to avoid this.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-11-01 12:45:46 -04:00
1 parent b38fe7d96d
commit 38eb938f22
3 files changed
+63 -9

No files matched your search

@@ -35,12 +35,6 @@ class EcrTest {
@BeforeAll
static void setup() {
ecr = TestFixtures.ecrClient();
// Floci removes the backing registry when the last repository goes and starts a new one
// on the next create, which can stall for as long as Floci caches the old container's
// address. These tests are not about that, so one repository stays for the whole class.
String keepRegistry = "floci-it/keep-registry-" + System.nanoTime();
ecr.createRepository(b -> b.repositoryName(keepRegistry));
reposToCleanup.add(keepRegistry);
}
@AfterAll