# How to Stop and Delete All Containers in InternetIncome: Complete Guide

> Learn how to stop and delete all containers in InternetIncome using the simple bash command. Safely remove script-related Docker resources while preserving others.

- Repository: [engageub/internetincome](https://github.com/engageub/internetincome)
- Tags: how-to-guide
- Published: 2026-03-01

---

**Use `sudo bash internetIncome.sh --delete` to safely stop and delete all containers, networks, and temporary files created by the InternetIncome script while leaving unrelated Docker resources untouched.**

The `engageub/internetincome` repository provides a unified Bash controller ([`internetIncome.sh`](https://github.com/engageub/internetincome/blob/main/internetIncome.sh)) that orchestrates multiple Docker containers for passive income generation. When you need to stop and delete all containers in InternetIncome to reset your environment or troubleshoot issues, the script provides a native cleanup mode that targets only its own resources. This built-in approach reads internal tracking files to avoid destroying unrelated workloads on your host.

## Using the Native Delete Command

The safest method to stop and delete all containers in InternetIncome is invoking the script's dedicated delete mode:

```bash
sudo bash internetIncome.sh --delete

```

This single command executes a comprehensive cleanup workflow defined in [`internetIncome.sh`](https://github.com/engageub/internetincome/blob/main/internetIncome.sh) (lines 1225–1312). Unlike manual Docker commands that affect every container on your host, this targeted approach reads the `container_names_file` and `networks_file` variables to identify exactly which resources belong to InternetIncome.

## What the Delete Process Actually Does

When you execute the `--delete` flag, the script performs a six-stage teardown sequence:

### Process Detection and Safety Checks

First, the script verifies no other instance is running by checking for a PID file defined by the `process_id_file` variable. If a process is detected at lines 1229–1247, it prompts you to stop it before proceeding to prevent data corruption during cleanup.

### Container Termination and Removal

The script reads container names from `container_names_file` and forcibly stops and removes each one using `sudo docker rm -f $i`. This loop at lines 6261–6268 ensures every InternetIncome container is destroyed regardless of current running state.

### Network Cleanup

Docker networks created by the script are tracked in `networks_file`. The script iterates through this list at lines 7778–7784 and executes `sudo docker network rm` on each entry to remove the isolated network stacks.

### File System Cleanup

The script purges backup files, temporary folders, and configuration artifacts stored in the `files_to_be_removed` and `folders_to_be_removed` arrays. This operation at lines 9120–9136 removes items such as browser data directories (`firefoxdata`, `chromeData`), proxy backups, and log files.

### Docker-in-Docker Cleanup

When running inside a DIND container, the script launches a transient Alpine container to remove the same files from the host bind-mount using a command like `sudo docker run --rm ... sh -c 'for file in "$@"; ...'` (lines 9129–9135). This ensures no orphaned data remains on the host filesystem.

### Exit Sequence

After completing all cleanup operations, the script exits with status `1` at line 1312 to halt further processing and signal completion of the delete routine.

## Manual Cleanup Alternatives (Use With Caution)

While the built-in command is recommended, you can perform manual cleanup if debugging or when the script is unavailable.

### Nuclear Option (All Docker Resources)

To stop and remove every container on your host—not just InternetIncome instances—run:

```bash
docker stop $(docker ps -q)
docker rm -f $(docker ps -aq)
docker network prune -f

```

**Warning:** This destroys all containers and networks on the machine, including those from unrelated projects, and bypasses the script's cleanup of backup files.

### Selective Manual Cleanup

You can replicate the script's behavior manually using its tracking files located in the working directory:

```bash

# Stop and remove only InternetIncome containers

if [ -f container_names.txt ]; then
  while read -r ctr; do
    sudo docker rm -f "$ctr"
  done < container_names.txt
fi

# Remove associated networks

if [ -f networks.txt ]; then
  while read -r net; do
    sudo docker network rm "$net"
  done < networks.txt
fi

# Clean up generated files

rm -f *.backup *.txt
rm -rf firefoxdata chromeData adnadeData

```

## Summary

- Execute `sudo bash internetIncome.sh --delete` to stop and delete all containers in InternetIncome safely according to the `engageub/internetincome` source code.
- The script identifies resources via internal tracking files (`container_names_file`, `networks_file`) to avoid affecting unrelated Docker objects.
- The cleanup process removes containers (lines 6261–6268), networks (lines 7778–7784), backup files, and Docker-in-Docker artifacts (lines 9120–9136) in a specific sequence.
- Manual global `docker rm` commands affect all containers on the host and should only be used when the script is inaccessible.

## Frequently Asked Questions

### What files track the containers created by InternetIncome?

The script stores container names in [`container_names.txt`](https://github.com/engageub/internetincome/blob/main/container_names.txt) (referenced internally as `$container_names_file`) and network IDs in [`networks.txt`](https://github.com/engageub/internetincome/blob/main/networks.txt) (`$networks_file`). These files are located in the script's working directory and are read during the delete operation at lines 6261 and 7778.

### Will the delete command remove containers from other applications?

No. The `--delete` mode only targets containers listed in the script's tracking files. It explicitly iterates through `container_names_file` rather than using global Docker commands, ensuring unrelated containers remain untouched.

### How do I stop containers without deleting them?

To stop containers while preserving them for later restart, iterate through the container names file and use `docker stop` instead of `docker rm`:

```bash
while read -r ctr; do
  sudo docker stop "$ctr"
done < container_names.txt

```

### What happens if I run the delete command while InternetIncome is running?

The script checks for an existing PID file at `$process_id_file` (lines 1229–1247). If it detects a running process, it displays a warning and exits to prevent corruption or inconsistent state during the cleanup operation.