kolla-ansible/tools/validate-docker-execute.sh
Marc 'risson' Schmitt 839ec629bf
tools: use /usr/bin/env bash instead of /bin/bash
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Change-Id: I374f7427a4318d00ca474367818117e11789ec13
2021-08-17 14:29:33 +02:00

15 lines
397 B
Bash
Executable File

#!/usr/bin/env bash
#
# This script can be used to check user privilege to execute
# docker commands
function check_dockerexecute {
sudo docker ps &>/dev/null
return_val=$?
if [ $return_val -ne 0 ]; then
echo "User $USER can't seem to run Docker commands. Verify product documentation to allow user to execute docker commands" 1>&2
exit 1
fi
}
check_dockerexecute