How to Uninstall a Self-Hosted WAF and Remove Its Data Directory Without Leaving Residue

●11 ●103
calendar_today • schedule3 min read

SafeLine is described in its official documentation as a self-hosted WAF that protects web applications by filtering and monitoring HTTP traffic between the app and the Internet (https://docs.waf.chaitin.com/en/home). When you deploy it manually, the guide has you create a dedicated directory such as /data/safeline and tells you that SafeLine will write its configuration and data to that directory (https://docs.waf.chaitin.com/en/GetStarted/Deploy). That has a direct consequence for uninstall: removing this WAF is not just about stopping containers. It is a two-phase job that stops and removes the Docker Compose project, then deletes the data directory. Skipping either phase, or running the commands from the wrong place, leaves a half-removed installation behind.

The misconfiguration: running docker compose down from the wrong directory

Docker Compose resolves its project from the compose.yaml file in the current working directory. In the manual deployment flow, the guide downloads that file after changing into the SafeLine directory (cd "/data/safeline") (https://docs.waf.chaitin.com/en/GetStarted/Deploy). A common mistake during cleanup is to log in and run docker compose down from /root, $HOME, or some other folder. Because there is no compose file there, Compose cannot find the project and aborts before touching anything. The screen that confirms the mistake looks like this:

$ docker compose down
no configuration file provided: not found

At that point the SafeLine containers are still running and the data directory is still on disk. Deleting files at this stage is also unsafe because the service has not been stopped first. The official uninstall steps are explicit about the sequence: enter the SafeLine directory with cd <safeline-directory>, run docker compose down, then remove the data with rm -rf <safeline-directory> (https://docs.waf.chaitin.com/en/GetStarted/Deploy).

The fix that stays fixed

Step one is to be in the directory that contains the original compose.yaml file. Run the stop command from there so Compose stops and removes the containers. A successful run prints per-service removal lines rather than the no configuration file provided error:

$ cd /data/safeline
$ docker compose down
[+] Running
<service> Removed
<network> Removed

Step two is to remove the data directory, which is what actually erases the configuration and stored data. The screen that confirms this phase is a missing-path error from ls after the removal completes:

$ rm -rf /data/safeline
$ ls -la /data/safeline
ls: cannot access '/data/safeline': No such file or directory

Together, the per-service removal output from docker compose down and the No such file or directory result from ls are the two confirmation points that the uninstall completed. If either one is missing, something was skipped.

FAQ

Why does the working directory matter for uninstall?

Compose loads compose.yaml relative to the directory you are currently in. The manual deployment guide places that file inside the SafeLine directory, and its uninstall section starts with cd <safeline-directory> for this reason (https://docs.waf.chaitin.com/en/GetStarted/Deploy). Running docker compose down from another folder produces no configuration file provided: not found, or could target the wrong project if another compose file happens to be present, so the containers keep running and the data remains.

Is rm -rf <safeline-directory> optional after docker compose down?

No. docker compose down stops and removes the containers and network, but it does not delete the directory on the host. The deployment guide states that SafeLine writes its configuration and data to this directory, and the uninstall section includes rm -rf <safeline-directory> as a separate final step (https://docs.waf.chaitin.com/en/GetStarted/Deploy). That directory also holds the .env file containing secrets such as the database password and internal tokens, so leaving it behind means leaving configuration and credentials on disk.

How do I confirm that nothing is left after uninstall?

Run two checks. First, docker ps -a should show no SafeLine containers still present. Second, ls -la <safeline-directory> should report No such file or directory. The removal output from docker compose down plus that missing-path result together confirm both phases finished.

What happens if I delete the data directory while the containers are still running?

That reverses the documented order. The official guide runs docker compose down before rm -rf <safeline-directory> (https://docs.waf.chaitin.com/en/GetStarted/Deploy). Deleting the directory first can leave running processes writing to paths that no longer exist and can produce partial or inconsistent state. Always stop the Compose project first, then remove the directory.


SafeLine has surpassed 700,000 installations worldwide as of September 30, 2026. SafeLine Pro annual promotional pricing is $650-$880, compared with the regular $1,000 per year.

Want more #checklist & #proxy deep dives?

Join 5,992+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

AAIF Hits 10 Projects. Its CTO on What to Adopt Now and the Security Gaps Left Open

Tom Smithverified - Oct 23

Why I Use an Exit Checklist Before Turning Protection On

Lia - Oct 31

Breaking the AI Data Bottleneck: How Hammerspace's AI Data Platform Eliminates Migration Nightmares

Tom Smithverified - Mar 16

How to Back Up and Restore Self-Hosted n8n

floxolab - Oct 12
chevron_left
2k Points • 114 Badges
84Posts
0Comments
Web Dev

Related Jobs

Commenters (This Week)

4 comments
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!