Skip to content

Add check for docker version to ensure the correct prune command #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Unraid_check_docker_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ echo
echo "---------------------------------------------------------------------------------"
echo
if [ "$remove_unconnected_volumes" == "yes" ] ; then
echo "Removing unconnected docker volumes"
echo
docker volume prune -f
echo "Removing unconnected docker volumes"
echo
# Check if docker major version is 23 or greater to ensure we use the correct command
docker_version=`(docker --version | awk -F'[ ,]+' '{print $3}' | awk -F'.' '{print $1}')`
if [ "$docker_version" -ge 23 ] ; then
docker volume prune -f --all
else
docker volume prune -f
fi
else
echo "Not removing unconnected docker volumes (this can be set in script if you want to)"
fi
Expand Down