-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker_updater.sh
38 lines (31 loc) · 1.15 KB
/
docker_updater.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
###
#
# N3rdP1um23
# January 18, 2020
# The following file is used to handle updating either all docker containers or only ones specified
# https://github.com/N3rdP1um23/docker_container_updater_helper
#
###
# Execute the script in the same folder the script resides in (alows relative execution)
cd $( dirname "${BASH_SOURCE[0]}" )
# Check to see if there are any arguments
if [ "$#" -lt 1 ]; then
# Display a status message
echo "No arguments provided. Starting normal Docker container updates"
# Execute the Docker update
docker-compose pull && docker-compose up -d && docker system prune -af --volumes
# Display a status message
echo "Finished Docker container updates"
elif [ "$#" -ge 1 ]; then
# Iterate over each of the arguments provided
for container in "$@"; do
# Display a status message
echo "Updating ${container} container"
# Execute the Docker update
docker-compose pull ${container} && docker-compose up -d ${container} && docker system prune -af --volumes
# Display a status message
echo "Finished ${container} container updates"
echo ""
done
fi