first commit 🚀
This commit is contained in:
commit
9d6f036ead
4 changed files with 128 additions and 0 deletions
38
container-update.sh
Normal file
38
container-update.sh
Normal file
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
for compose_file in /opt/docker/**/docker-compose.yml; do
|
||||
if [[ $(docker compose -f "$compose_file" ps -q) ]]; then
|
||||
echo "> Updating $compose_file"
|
||||
docker compose -f "$compose_file" pull
|
||||
docker compose -f "$compose_file" up -d --remove-orphans
|
||||
echo ""
|
||||
else
|
||||
echo "> Skipping $compose_file as it's not running."
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
|
||||
echo "> Containers have been updated."
|
||||
echo ""
|
||||
|
||||
confirm=n
|
||||
read -p "
|
||||
> Do you want to prune docker? [y/N]
|
||||
> WARNING! This will remove:
|
||||
> - all stopped containers
|
||||
> - all networks not used by at least one container
|
||||
> - all dangling images
|
||||
> - unused build cache
|
||||
" confirm
|
||||
echo ""
|
||||
|
||||
if [[ $confirm == [yY] ]]; then
|
||||
docker system prune -f -a
|
||||
echo "> Docker has been pruned."
|
||||
else
|
||||
echo "> Nothing has been changed."
|
||||
fi
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue