Recently, I have deployed several frequently updated containers using Docker, such as immich (self-built photo album service) and open-webui (web-based LLM front-end UI). These containers are updated almost every day. I used watchtower to perform hourly detection and automated update tasks.

This morning, my NAS suddenly reported an error, indicating that the storage space used to store Docker images was about to run out. After checking, I found that a large number of unused residual images were occupying the space. The error was resolved after manual cleanup.

The thorough solution to this problem is to add --cleanup to the watchtower startup command, ensuring that watchtower performs automatic cleanup after updating containers, deleting unused container images.

docker run -d --name watchtower   --volume /var/run/docker.sock:/var/run/docker.sock   containrrr/watchtower -i 300 open-webui immich_server immich_machine_learning immich_postgres immich_redis ollama allinone --cleanup