Automated Docker cleanup

Docker stores images and build files on the server. Over time, unused files can fill the disk and prevent deployments from completing.

Coolify can clean the server automatically on a schedule or when disk usage reaches a limit.

Docker cleanup can use significant CPU

Docker cleanup can be CPU-intensive while it scans and removes unused data. If the server has limited CPU resources, schedule cleanup less frequently and run it when applications receive less traffic.


Configure Docker cleanup

Open Docker Cleanup

  1. Open Servers in the Coolify sidebar.
  2. Select the server you want to clean.
  3. Select Docker Cleanup in the server menu.

The page shows the cleanup settings and recent cleanup executions.

Choose when cleanup runs

Start with these settings:

  • Keep Cleanup frequency at 0 0 * * * to check once each day at midnight.
  • Set Cleanup trigger to Run on every schedule if you want cleanup to run every time the schedule is due.
  • Set Cleanup trigger to Only above disk threshold if cleanup should wait until disk usage reaches Disk threshold.
  • Keep the threshold at 80 unless you need cleanup to start sooner.

Select Save changes after changing the schedule or threshold.

A safe starting configuration

Keep volume and network deletion disabled. Leave application image retention enabled. This removes common unused Docker data without deliberately pruning persistent volumes or every rollback image.

Choose what Coolify may delete

Under Advanced cleanup, the defaults keep unused volumes, unused networks, and retained application images:

Setting and choiceWhat happens
Unused volumes > Delete unused volumesDeletes every Docker volume that is not currently attached to a container.
Unused networks > Delete unused networksDeletes every Docker network that is not currently used by a container.
Application images > Delete all old imagesRemoves old application images instead of keeping the configured number for rollback.
Unused volumes can still contain important data

A stopped or removed container can leave an unused volume containing application or database data. Back up important data and identify every volume before enabling Unused volumes > Delete unused volumes.

Keep Keep unused volumes, Keep unused networks, and Keep retained images selected unless you have confirmed the unused objects can be deleted.

Run a manual cleanup

Use a manual cleanup to confirm the settings before relying on the schedule:

  1. Review the three advanced cleanup options.
  2. Select Run cleanup and review the confirmation, then select Run Docker Cleanup.
  3. Wait for the execution to finish.

A manual cleanup does not wait for the schedule or disk threshold. If another cleanup is running, it waits for that execution instead of being dropped. Only one cleanup runs per server at a time.

Review the result

Open Recent executions and select the latest cleanup.

Confirm that:

  1. the execution completed successfully
  2. the command output does not show an unexpected error
  3. disk usage decreased when unused data was available
  4. important applications and databases still work
  5. the application rollback images you expect are still available

Cleanup after resource operations

Stopping or deleting a resource triggers Docker cleanup only when disk usage is at or above the configured cleanup threshold and no cleanup has completed in the last hour. Scheduled cleanup is dispatched every minute by its own scheduler process. Lost queued cleanup jobs are recorded as failed and the team is notified.

On this page