# RepositoryAutoDeleteImages

ECR-specific Mixin to force-delete all images from a repository when the repository is removed from the stack or when the stack is deleted.

Sets the `emptyOnDelete` property on the repository.

Extends: [Mixin](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Mixin.html) › RepositoryAutoDeleteImages
Implements: [IMixin](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.IMixin.html)

- Source: [`aws-ecr/lib/mixins/repository.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ecr/lib/mixins/repository.ts#L11)
- Type last changed: v2.242.0 · 10 Mar 2026

## Example

TypeScript:

```ts
new ecr.CfnRepository(this, 'Repo')
  .with(new ecr.mixins.RepositoryAutoDeleteImages());
```

Python:

```python
ecr.CfnRepository(self, "Repo").with(ecr.mixins.RepositoryAutoDeleteImages())
```

Java:

```java
new CfnRepository(this, "Repo").with(new RepositoryAutoDeleteImages());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
new CfnRepository(this, "Repo").With(new Mixins.RepositoryAutoDeleteImages());
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
ecr.NewCfnRepository(this, jsii.String("Repo")).With(mixins.NewRepositoryAutoDeleteImages())
```

## Initializer

TypeScript:

```ts
new RepositoryAutoDeleteImages()
```

Python:

```python
RepositoryAutoDeleteImages()
```

Java:

```java
new RepositoryAutoDeleteImages()
```

C# / .NET:

```csharp
new RepositoryAutoDeleteImages()
```

Golang:

```go
NewRepositoryAutoDeleteImages()
```

## Methods

- `applyTo(construct: IConstruct): void` — Applies the mixin functionality to the target construct.

- `isMixin(x: any): boolean` (static) — Checks if `x` is a Mixin.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Mixin`.

- `supports(construct: IConstruct): boolean` — Determines whether this mixin can be applied to the given construct.
