🛠️ Maintenance Script for Docker Containers
Automates updating your Docker containers on Debian-based systems by pulling the latest images, restarting services, and cleaning up unused resources.
🚀 Installation, Setup & Running
Download the maintenance script to your Docker project directory:
# cd into the docker folder
wget -qO update-docker.sh https://gitea.featherer.xyz/nono/Scripts/raw/branch/main/update-docker/update-docker.sh
source update-docker.sh
Or, when run locally (replace the ip address to your own)
# cd into the docker folder
wget -qO update-docker.sh http://10.1.0.102:3000/nono/Scripts/raw/branch/main/update-docker/update-docker.sh
source update-docker.sh
🔄 What It Does
- Updates system packages
Runs
apt updateandapt upgrade -yto ensure your host is up to date. - Refreshes Docker services
Executes
docker-compose pull,docker-compose down, anddocker-compose up -dto fetch new images and restart containers. - Cleans up unused resources
Calls
docker system prune -a -fto remove dangling images, stopped containers, and unused networks. - Verifies running containers
Lists active containers with
docker psso you can confirm everything is up and running.
📝 Prerequisites
- Debian-based OS (e.g., Debian, Ubuntu)
- Docker & Docker Compose installed
- A user with sudo privileges or in the docker group