Title
Removing an agent does not clean up its Cloudflare tunnel or orphaned cloudflared container
Description
When removing a DockFlare Agent from the Master UI, the agent record is removed from DockFlare, but the Cloudflare-side tunnel and the cloudflared container created on the Docker host continue running.
As a result, services can remain publicly reachable even after the agent has been removed from DockFlare.
Expected behavior
When an agent is removed from the Master UI, DockFlare should either:
- clean up the Cloudflare resources associated with that agent, including the tunnel, public hostnames, ingress rules, and DNS records; or
- clearly warn the user that removing the agent only removes the local DockFlare record and does not clean up Cloudflare-side resources or the cloudflared container.
Ideally, if the agent is still reachable, DockFlare should also send a command to stop/remove the cloudflared tunnel container created by the agent.
Actual behavior
After removing an agent from the DockFlare UI:
- the agent disappears from DockFlare / shows as removed;
- the Cloudflare tunnel associated with that agent still exists;
- public hostnames / ingress routes associated with the tunnel remain active;
- the automatically created cloudflared container on the host continues running;
- the service remains publicly accessible.
Why this is problematic
From a user perspective, “Remove Agent” implies that this host is no longer managed by DockFlare and should no longer publish services through Cloudflare.
However, because the Cloudflare tunnel and cloudflared container continue to run, the user may incorrectly believe the services have been unpublished while they are still publicly reachable.
This is especially risky when removing an agent because the host should no longer expose any services publicly.
Suggested behavior
Possible fixes:
- On agent removal, delete or disable all Cloudflare tunnel routes and DNS records owned by that agent.
- If the agent is still connected, send a cleanup command to stop / remove the generated cloudflared container.
- If the agent is disconnected and cleanup is impossible, show a clear warning such as:
This agent has been removed from DockFlare, but its cloudflared container may still be running. Please manually stop the agent stack or delete the Cloudflare tunnel to fully disable public access.
- Optionally provide a “Force cleanup Cloudflare resources” action from the Master UI.
Notes
This seems different from graceful deletion for stopped containers. Graceful deletion makes sense for temporary container restarts, but removing an agent appears to be an explicit intent to decommission that host from DockFlare's management.
In that case, leaving the Cloudflare tunnel and public hostnames active is unexpected and potentially unsafe.
Title
Removing an agent does not clean up its Cloudflare tunnel or orphaned cloudflared container
Description
When removing a DockFlare Agent from the Master UI, the agent record is removed from DockFlare, but the Cloudflare-side tunnel and the cloudflared container created on the Docker host continue running.
As a result, services can remain publicly reachable even after the agent has been removed from DockFlare.
Expected behavior
When an agent is removed from the Master UI, DockFlare should either:
Ideally, if the agent is still reachable, DockFlare should also send a command to stop/remove the cloudflared tunnel container created by the agent.
Actual behavior
After removing an agent from the DockFlare UI:
Why this is problematic
From a user perspective, “Remove Agent” implies that this host is no longer managed by DockFlare and should no longer publish services through Cloudflare.
However, because the Cloudflare tunnel and cloudflared container continue to run, the user may incorrectly believe the services have been unpublished while they are still publicly reachable.
This is especially risky when removing an agent because the host should no longer expose any services publicly.
Suggested behavior
Possible fixes:
Notes
This seems different from graceful deletion for stopped containers. Graceful deletion makes sense for temporary container restarts, but removing an agent appears to be an explicit intent to decommission that host from DockFlare's management.
In that case, leaving the Cloudflare tunnel and public hostnames active is unexpected and potentially unsafe.