← Knowledge Base
DockerReference note1 min read · updated 2026-11-27

Update containers and clean up old images safely

Pull new images, recreate only what changed, and reclaim disk space without deleting data.

dockerupdatesdisk
cd ~/stack
docker compose pull                 # fetch newer images
docker compose up -d                # recreate only containers whose image changed
docker image prune -f               # remove dangling images
docker system df                    # what is using space

docker system prune removes stopped containers, unused networks and dangling images. Add -a to remove all unused images and --volumes to remove unused volumes: volumes may hold your data, so look at docker volume ls first and back up before pruning them. Pin versions and read the release notes for major updates of databases. Keep a way back: note the previous image tag or digest.