revert to run with sudo
`docker` group is non-standard so sudo seems to be the most portable option`
This commit is contained in:
parent
f9d97ee1ab
commit
cda45481f6
|
@ -4,24 +4,6 @@ set -e
|
|||
|
||||
# we first check whether the user is in the group docker
|
||||
user=$(id -un)
|
||||
is_in_docker_group=0
|
||||
for group in $(id -Gn)
|
||||
do
|
||||
if [ $group = "docker" ]
|
||||
then
|
||||
is_in_docker_group=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $is_in_docker_group -eq 0 ]
|
||||
then
|
||||
echo "Adding user to docker group"
|
||||
sudo usermod -a -G docker ${user}
|
||||
echo "Please log out and back in again to reload group list"
|
||||
echo "Afterwards you need to call this script again"
|
||||
exit
|
||||
fi
|
||||
|
||||
DIR_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
|
||||
group=$(id -gn)
|
||||
uid=$(id -u)
|
||||
|
@ -48,7 +30,7 @@ do
|
|||
echo "RUN groupadd -g ${gids[$i]} ${groups[$i]}" >> Dockerfile
|
||||
if [ ${gids[i]} -ne ${gid} ]
|
||||
then
|
||||
if [ -z ${additional_groups} ]
|
||||
if [ -z "${additional_groups}" ]
|
||||
then
|
||||
additional_groups="-G ${gids[$i]}"
|
||||
else
|
||||
|
@ -67,7 +49,7 @@ EOF
|
|||
|
||||
echo "Created ${tmpdir}"
|
||||
echo "Buidling Docker container ${image}"
|
||||
docker build -t ${image} .
|
||||
sudo docker build -t ${image} .
|
||||
|
||||
popd
|
||||
|
||||
|
@ -85,7 +67,7 @@ then
|
|||
fi
|
||||
|
||||
|
||||
docker run --rm `# delete (temporary) image after return` \\
|
||||
sudo docker run --rm `# delete (temporary) image after return` \\
|
||||
-it `# Run in interactive mode and simulate a TTY` \\
|
||||
--privileged=true `# Run in privileged mode ` \\
|
||||
--cap-add=SYS_PTRACE \\
|
||||
|
|
Loading…
Reference in New Issue