Skip to content

Instantly share code, notes, and snippets.

@UltimateByte
Last active December 1, 2025 00:09
Show Gist options
  • Select an option

  • Save UltimateByte/63fcd5655ac90b4a00d63e68743763bf to your computer and use it in GitHub Desktop.

Select an option

Save UltimateByte/63fcd5655ac90b4a00d63e68743763bf to your computer and use it in GitHub Desktop.
Update all docker-compose
#!/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