﻿# Delete BRIX AI when using Docker Swarm

> [HTML Version](delete-cortex-docker-swarm.html)

When you install **BRIX AI** in Docker Swarm, it creates a stack representing your installation instance. You can delete this stack along with all server data.

## Delete stack while preserving data

To remove all **BRIX AI** services from the Docker Swarm cluster without clearing data, use one of the following methods:

- Run the uninstallation script.

````
chmod +x uninstall.sh  
./uninstall.sh

````
If you use multiple instances of **BRIX AI** and [specify the project name in scripts](cortex-environment-variables.md#project-name):

````
./uninstall.sh --project-name my-cortex

- ````
Remove the stack from Docker Swarm manually.

````
docker stack rm brix-cortex

## ````
Delete stack and data

To permanently delete **BRIX AI** and all its data:

1. Delete the stack using the command:

````
./uninstall.sh

````
If you use multiple instances of **BRIX AI** and [specify the project name in scripts](cortex-environment-variables.md#project-name):

````
./uninstall.sh --project-name my-cortex

2. ````
Wait for all services to stop.

3. Delete data volumes:

````
docker volume rm \$(docker volume ls -q -f name=elma-cortex)

````
This will also delete the data of the Caddy internal certificate authority. If you use **Internal** as your [TLS certificate management mode](cortex-tls-settings.md), you need to [export the Caddy root certificate](#caddy) again after reinstallation and add it to trusted certificates.