> ## Documentation Index
> Fetch the complete documentation index at: https://namespace.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# nsc registry policy set

Set the registry expiration policy.

`registry policy set` configures the image expiration policy for your workspace's
[Namespace Container Registry](/docs/architecture/storage/container-registry). By default, images
stored in nscr.io never expire; once an image expires it can no longer be accessed and the
underlying blobs are automatically deleted.

With no `--repository` flag, the command updates the default policy that applies to every
repository without a repository-specific override. Pass `--repository` to instead set (or
override) the policy for that specific repository.

## Usage

```bash theme={null}
nsc registry policy set [--default_expiration <duration>] [--no-expiration] [--repository <repository>]
```

### Example

```bash theme={null}
nsc registry policy set --default_expiration=168h
```

```text nocopy Output theme={null}
Default configuration has been updated to expire images after 168h0m0s.
```

Set a repository-specific expiration:

```bash theme={null}
nsc registry policy set --repository my-app --default_expiration=24h
```

```text nocopy Output theme={null}
Policy for repository "my-app" has been updated to expire images after 24h0m0s.
```

Set the default policy to never expire images:

```bash theme={null}
nsc registry policy set --no-expiration
```

```text nocopy Output theme={null}
Default configuration has been updated to never expire images.
```

## Options

<h3 id="--default_expiration-duration">
  \--default\_expiration \<duration>
</h3>

The expiration duration applied to new images (e.g., `168h` for 7 days). Needs to be at least 4
hours.

<h3 id="--no-expiration">
  \--no-expiration
</h3>

Set images to never expire. This overrides any previously configured expiration duration for the
target policy (the default policy, or the repository given via `--repository`).

<h3 id="--repository-repository">
  \--repository \<repository>
</h3>

Set the policy for a specific repository. If not specified, sets the default policy that applies
to all repositories without a repository-specific override.

## Related Topics

* [nsc registry policy get](/docs/reference/cli/registry-policy-get)
* [nsc registry policy](/docs/reference/cli/registry-policy)
