Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Use a bounded, age-filtered cleanup rather than an unqualified docker system prune -af. On a small VPS, inspect usage, define how long rollback material must remain available, and run a root-owned script such as docker system prune --force --filter 'until=168h' from a systemd timer or cron. This removes eligible stopped containers, unused networks, dangling images and build cache while leaving volumes untouched.

The seven-day period is a starting policy, not a universal best value. Your deployment frequency, rollback window, image size and available disk determine whether seven days is sufficient. Measure with docker system df -v before and after each run, and treat volumes and logs as separate storage policies.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What Docker cleanup does—and does not do automatically

Docker deliberately keeps most objects until an operator removes them. Stopped containers, old image layers, unused networks and build cache can therefore consume a VPS disk even when no container is currently using them. A scheduled prune is an explicit housekeeping task; Docker does not silently apply your preferred retention period.

The broad command is docker system prune. Its normal scope includes:

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.
  • stopped containers;
  • networks not used by any container;
  • dangling images (layers no longer associated with a tagged image); and
  • unused build cache.

Volumes are intentionally excluded from the default system prune. A volume can contain a database, uploads or another application’s durable state, so removing it requires a separate decision. Running docker system prune --volumes changes that safety boundary and should not be part of an unattended job until every volume has been classified.

Why -a needs a rollback decision

The -a (or --all) option broadens image deletion from dangling images to every image that is not referenced by a container. That can include a locally cached release you intended to use for an immediate rollback. A host with aggressive image cleanup may save more space but will have to pull the rollback image again, and a failed registry connection can make recovery slower or impossible. Add -a only when that trade-off is acceptable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Measure the host before choosing a policy

Run the following as a user who can access the Docker daemon (normally root or a member of the Docker group):

docker system df -v
docker ps -a
docker image ls
docker volume ls

docker system df -v reports Docker’s view of reclaimable and active space, including per-image and per-container detail. It does not promise a fixed amount of savings: the result depends on which objects exist on this host. Save the pre-cleanup output, run the candidate command interactively, and collect the same report afterward. The difference is the only reliable reclaimed-space figure for your VPS.

Inventory stopped containers and images that support rollback. For each volume, record its name, the service that owns it and where its backup is verified. If a deployment tool adds labels, note those labels now; they can later become an explicit keep/delete policy.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

Choose a retention and deletion scope

Write down the longest period for which an unused object might still be needed. Include your normal release interval, the time you keep a previous release, and the time required to diagnose a failed deployment. A seven-day (168-hour) retention window is a reasonable starting point for a small VPS, provided it is checked against those operational requirements.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Policy Command pattern Objects affected Rollback and data risk When it fits
Conservative system cleanup docker system prune --force --filter 'until=168h' Eligible stopped containers, unused networks, dangling images and build cache; no volumes Leaves images referenced by containers and all volumes; generally the safest unattended default Most small VPS installations
Broader image cleanup docker system prune --all --force --filter 'until=168h' The conservative scope plus images not referenced by any container that pass the age filter Can delete locally cached rollback images Hosts where unreferenced images are disposable and registry recovery is acceptable
Container-only cleanup docker container prune --force --filter 'until=168h' Stopped containers passing the filter Does not remove images, networks, volumes or build cache When stopped-container metadata is the immediate problem
Image-only cleanup docker image prune --all --force --filter 'until=240h' Images not referenced by any container and older than the selected period May remove rollback images; does not touch containers or volumes When image layers dominate usage and a longer ten-day window is desired
Anonymous-volume cleanup docker volume prune --force Unused anonymous local volumes Data in an anonymous volume is lost when that volume is deleted Only after confirming anonymous volumes are disposable
All-unused-volume cleanup docker volume prune --all --force Unused anonymous and named local volumes, subject to the CLI’s supported options Potentially destructive to persistent application data Only as a separately reviewed, backed-up operation
Bounded build-cache cleanup docker buildx prune with space limits BuildKit/buildx cache Future builds may become slower because cache layers must be rebuilt When build cache, rather than containers or images, is the main consumer

Option names and availability can differ with Docker Engine and API versions. Check the installed CLI with docker system prune --help, docker volume prune --help and docker buildx prune --help, then consult the reference that matches that installation before enabling an unattended timer.

Build a root-owned cleanup script

Keeping policy in a file makes it reviewable and prevents a scheduler from silently using a different working directory, PATH or Docker binary. Create /usr/local/sbin/docker-cleanup as root:

#!/bin/sh
set -eu

/usr/bin/docker system df
/usr/bin/docker system prune --force --filter 'until=168h'
/usr/bin/docker system df

Set ownership and permissions so an unprivileged account cannot alter a root-run policy:

sudo chown root:root /usr/local/sbin/docker-cleanup
sudo chmod 750 /usr/local/sbin/docker-cleanup
sudo /usr/local/sbin/docker-cleanup

The first and last reports provide an auditable before-and-after view in the scheduler’s log. set -e stops on a failed Docker command, while set -u catches unset variables if the script is expanded later. The absolute path avoids failures caused by cron or systemd having a minimal PATH.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

Do not add --volumes to this wrapper as a convenience. If you eventually create a volume policy, put it in a separate script with its own inventory, backup check and approval path. Keeping destructive volume work separate makes an accidental edit to the routine job less damaging.

Schedule it with a systemd service and timer

On distributions that use systemd, a timer provides explicit ordering, persistent missed-run behavior and journal logs. Create /etc/systemd/system/docker-cleanup.service:

[Unit]
Description=Prune aged Docker objects
After=docker.service
Requires=docker.service

[Service]
Type=oneshot
ExecStart=/usr/local/sbin/docker-cleanup

Create /etc/systemd/system/docker-cleanup.timer:

[Unit]
Description=Schedule Docker cleanup

[Timer]
OnCalendar=daily
Persistent=true

[Install]
WantedBy=timers.target

Load and enable the timer:

sudo systemctl daemon-reload
sudo systemctl enable --now docker-cleanup.timer
sudo systemctl status docker-cleanup.timer
sudo systemctl list-timers docker-cleanup.timer

Persistent=true allows systemd to run the service after the machine returns from a period when it was powered off. The service requires Docker and starts after the Docker service, reducing failures during boot. A daily trigger does not mean every object is deleted daily: the until=168h filter still protects anything newer than the retention window.

Inspect execution and failures with:

sudo journalctl -u docker-cleanup.service
sudo journalctl -u docker-cleanup.service --since '7 days ago'
sudo systemctl start docker-cleanup.service

Run the service manually first on a staging VPS or during a maintenance window. Confirm the output, verify that the intended rollback images remain, and only then leave the timer enabled.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use cron when systemd is not your scheduler

A root crontab can run the same root-owned wrapper. Edit it with sudo crontab -e and choose a quiet maintenance time:

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
30 03 * * * /usr/local/sbin/docker-cleanup >>/var/log/docker-cleanup.log 2>&1

This example runs daily at 03:30 in the host's local time. Make the log root-readable, monitor its growth and configure normal host log rotation; otherwise the cleanup log can become another source of disk usage. Cron supplies no dependency ordering, so ensure the Docker daemon is normally available at that time and investigate non-zero exits rather than ignoring them.

Target the object that is actually consuming space

Stopped containers

Use docker container prune --force --filter 'until=168h' when stopped containers are the only concern. It is narrower than a system prune and supports age and label filters. Running containers are not stopped or deleted by this command.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Images

Use docker image prune --all --force --filter 'until=240h' for an image-focused policy. The --all switch removes images not referenced by any container, so retain a window that covers your rollback plan. Without --all, image pruning is limited to dangling images.

Build cache

If docker system df -v shows build cache as the dominant reclaimable category, use docker buildx prune instead of widening image deletion. Buildx supports bounded policies using max-used-space, min-free-space and reserved-space. Those controls let you preserve a reserve for builds while reclaiming cache when a filesystem approaches its limit. Check the installed buildx help for exact syntax and units before putting it in a timer.

Networks

Unused networks are included in the conservative system prune. If a network is unexpectedly removed, inspect whether any container was attached at the time; active container attachments prevent it from being considered unused. Network cleanup normally has little rollback value compared with image retention, but a deployment that creates networks ahead of a release should account for the age filter.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Handle volumes as persistent data, not cache

List volumes and classify them before any volume prune:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
docker volume ls

Named volumes often hold database files, media or application state. Docker leaves them out of ordinary docker system prune precisely because “unused” at this instant does not prove that the data is disposable. A service may be stopped for maintenance while its volume remains the only copy of its data.

docker volume prune --force is limited to unused anonymous local volumes. The --all form broadens the operation to unused named volumes where supported by the installed API and CLI. Treat that as a destructive policy decision: verify ownership, confirm a recent restorable backup and apply labels or an explicit allow-list before scheduling it. Do not infer safety from a volume's lack of current attachments.

Use labels and retention to protect rollback material

Age alone cannot tell Docker that an unreferenced image is reserved for rollback. If your deployment tooling applies stable labels, use Docker's positive or negative label filters to express which objects may be pruned. For example, a policy can exclude objects carrying a keep label and allow cleanup of objects carrying an environment or lifecycle label. Check the relevant prune command's help for the supported label-filter syntax, then test it against a non-production copy of the inventory.

Keep the retention window at least as long as the rollback promise you make to operators. If releases occur every two weeks but the job keeps only seven days of unreferenced images, the previous release may be gone before the next release is proven stable. Conversely, retaining many large images on a small disk may require a registry pull during rollback; document that dependency and monitor registry availability.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not confuse Docker-object cleanup with log rotation

Pruning images and containers does not remove logs produced by a running container. Docker's logging guidance warns that excessive log output can fill a filesystem independently of Docker objects. Choose and configure an appropriate logging driver or rotation policy for your deployment, and monitor the host filesystem as a whole. A successful prune cannot recover space consumed by unrotated container logs.

Monitor results and failure modes

  • No space was reclaimed: inspect docker system df -v. The remaining data may be in active containers, referenced images, named volumes, build cache outside the selected scope or logs.
  • A rollback image disappeared: the job likely used --all or a filter that did not encode your keep rule. Restore the image from the registry, lengthen retention and add labels or an allow-list.
  • The timer fails with a Docker connection error: check systemctl status docker, the service's After/Requires relationship and the absolute Docker path. Review the journal for permission errors.
  • Cron reports “command not found”: use the absolute paths shown in the wrapper and confirm the crontab belongs to the account with daemon access.
  • Builds become slower after cleanup: cache pruning removed reusable layers. Bound buildx cache with a reserved-space or maximum-space policy rather than repeatedly deleting all cache.
  • The disk still fills between runs: shorten the schedule only after identifying the source. Check logs, volume growth and application data; increasing prune frequency will not fix a non-Docker consumer.

Set an alert for low free space and for a failed cleanup service. Review the before-and-after reports and disk trend, not merely the scheduler's “success” status. A command can complete successfully while reclaiming little space because no eligible objects existed.

A rollout checklist

  1. Run docker system df -v, docker ps -a, docker image ls and docker volume ls as the scheduler identity.
  2. Write down the rollback window and classify every named volume.
  3. Start with docker system prune --force --filter 'until=168h'; do not add --all or --volumes by habit.
  4. Save the wrapper as /usr/local/sbin/docker-cleanup, use /usr/bin/docker, and set root ownership and restrictive permissions.
  5. Run it interactively on staging or during a maintenance window and compare the two disk reports.
  6. Schedule it with a systemd timer or root cron, then inspect logs after the first run.
  7. Add a separate, bounded buildx policy only if build cache is the dominant consumer.
  8. Alert on free-space thresholds and failed jobs, and revisit retention whenever deployment or rollback practice changes.

The practical default is therefore a daily or weekly, root-owned, age-filtered system prune that leaves volumes alone. Expand the scope only when measurements show a specific category needs attention and your rollback and backup policies explicitly allow the deletion.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.