# Purge Docker & Components

It might be helpful to purge Docker and all its components before performing a fresh installation of Helmut4 using its install script. This is particularly important if Docker and Portainer were previously installed, as this can lead to execution errors with the default install script.

### Delete Stacks

```bash
sudo docker stack ls
sudo docker stack rm helmut
```

### Stop & Delete Container

```bash
sudo docker ps
sudo docker stop <containerID>
sudo docker rm <containerID>


docker rmi -f $(docker images -aq) 
```

### Delete Container Volumes

```bash
sudo docker volume ls
sudo docker volume rm portainer_data
sudo docker volume rm helmut4_mcc_mongodb
```

### Uninstall Docker Engine

```bash
sudo apt-get purge -y docker-engine docker docker.io docker-ce docker-ce-cli docker-compose-plugin docker-compose
sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce docker-compose-plugin docker-compose
```

### Delete Docker related folders

Note: not all folders might be available, if so ignore the error message

```bash
sudo rm -rf /var/lib/docker /etc/docker
sudo rm /etc/apparmor.d/docker
sudo groupdel docker
sudo rm -rf /var/run/docker.sock
sudo rm -rf /var/lib/containerd
sudo rm -r ~/.docker
```

### Check for missing Docker components

```bash
dpkg -l | grep -i docker
```

### Delete misc Docker source lists

```bash
sudo rm /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_*
sudo rm /etc/apt/sources.list.d/docker.list
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.helmut.de/helmut4-releases/support/debug-or-log-collection/helmut4-server/purge-docker-and-components.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
