To Reproduce
- Deploy a Docker Compose stack via Dokploy that includes a one-off/sidecar service built from source (e.g. a backup runner with
entrypoint: ["true"] and restart: "no")
- Enable "Daily Docker Cleanup" (Settings → Web Server)
- Wait for the cleanup cron to run (daily at ~23:50)
- Observe that the built image is deleted because no running container references it
- Any process that depends on the image now fails with:
(HTTP code 404) no such container - No such image: <project>_<service>:latest
Current vs. Expected behavior
Current: Daily Docker Cleanup runs docker image prune -a --force, which removes ALL images not referenced by a running container — including images that Dokploy itself built via docker compose ... --build.
Expected: Images belonging to services within Dokploy-managed Compose stacks should be excluded from automated cleanup. Dokploy builds these images as part of the deployment; deleting them breaks the deployed stack.
Provide environment information
Dokploy Version: v0.28.4
OS: Ubuntu (Hetzner VPS)
Deployment: Self-hosted, same server
Which area(s) are affected? (Select all that apply)
Application
Are you deploying the applications where Dokploy is installed or on a remote server?
Same server where Dokploy is installed
Additional context
Root Cause
The cleanup executes docker image prune -a --force which is an indiscriminate operation. It does not distinguish between:
- Truly orphaned/leftover images from old deployments
- Images actively used by Compose services that run on-demand (job runners, sidecar containers, one-off tasks)
Any Compose service that is not continuously running (e.g. a backup runner that starts on-demand, exits, and is removed) will have its image deleted by the next cleanup cycle.
Impact
This creates a recurring failure pattern:
- Deployment works fine initially
- Cleanup runs overnight → image deleted
- On-demand service fails → manual redeploy required to rebuild image
- Cycle repeats daily until cleanup is disabled
Suggested Fix
At minimum, exclude images that match Compose services managed by Dokploy. The Compose project name and service labels (com.docker.compose.project, com.docker.compose.service) provide enough information to identify these images.
Alternatively, offer more granular cleanup options (retention count per repo, grace period) instead of the blunt prune -a --force.
Evidence
Dokploy container logs show the cleanup executing nightly:
Docker Cleanup 3/9/2026, 11:50:00 PM] Running docker cleanup
Docker Cleanup 3/10/2026, 11:50:00 PM] Running docker cleanup
Database confirms the setting was enabled:
SELECT "enableDockerCleanup" FROM "webServerSettings";
-- Result: t (true)
Will you send a PR to fix it?
No
To Reproduce
entrypoint: ["true"]andrestart: "no")(HTTP code 404) no such container - No such image: <project>_<service>:latestCurrent vs. Expected behavior
Current: Daily Docker Cleanup runs
docker image prune -a --force, which removes ALL images not referenced by a running container — including images that Dokploy itself built viadocker compose ... --build.Expected: Images belonging to services within Dokploy-managed Compose stacks should be excluded from automated cleanup. Dokploy builds these images as part of the deployment; deleting them breaks the deployed stack.
Provide environment information
Which area(s) are affected? (Select all that apply)
Application
Are you deploying the applications where Dokploy is installed or on a remote server?
Same server where Dokploy is installed
Additional context
Root Cause
The cleanup executes
docker image prune -a --forcewhich is an indiscriminate operation. It does not distinguish between:Any Compose service that is not continuously running (e.g. a backup runner that starts on-demand, exits, and is removed) will have its image deleted by the next cleanup cycle.
Impact
This creates a recurring failure pattern:
Suggested Fix
At minimum, exclude images that match Compose services managed by Dokploy. The Compose project name and service labels (
com.docker.compose.project,com.docker.compose.service) provide enough information to identify these images.Alternatively, offer more granular cleanup options (retention count per repo, grace period) instead of the blunt
prune -a --force.Evidence
Dokploy container logs show the cleanup executing nightly:
Database confirms the setting was enabled:
Will you send a PR to fix it?
No