Last active
December 1, 2025 00:09
-
-
Save UltimateByte/63fcd5655ac90b4a00d63e68743763bf to your computer and use it in GitHub Desktop.
Update all docker-compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # This script updates all of your docker compose images set in standard dir. | |
| # Export paths for running into a cronjob | |
| PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
| for dir in /opt/*/; do | |
| if [ -f "${dir}docker-compose.yml" ]; then | |
| compose="${dir}docker-compose.yml" | |
| elif [ -f "${dir}docker-compose.yaml" ]; then | |
| compose="${dir}docker-compose.yaml" | |
| else | |
| continue | |
| fi | |
| echo "=== Updating $dir ===" | |
| docker compose -f "$compose" pull | |
| docker compose -f "$compose" up -d | |
| done | |
| docker image prune -af | |
| echo "Done! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment