diff --git a/README.md b/README.md index f344c03..8f7a773 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ ssh virtualuser@ipAddress -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/ ``` And then launch this to install Rancher: + ```sh docker run -d --restart=unless-stopped -p 80:80 -p 443:443 --privileged rancher/rancher ``` diff --git a/custom/add_to_docker_group.sh b/custom/add_to_docker_group.sh new file mode 100755 index 0000000..1a0ee28 --- /dev/null +++ b/custom/add_to_docker_group.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +if [ "$(id -u)" -ne 0 ]; then + echo "This script should be run as root. Aborting..." > /dev/stderr + exit 1 +fi + +echo "Adding user to the docker group..." +# This if statement evaulates if the script is launched using sudo AND not +# a `sudo su` logged user +if [ -n "$SUDO_USER" ] && [ "$SUDO_COMMAND" != "/usr/bin/su" ]; then + usermod -aG docker "$SUDO_USER" +else + usermod -aG docker "$(id -un)" +fi diff --git a/custom/main.sh b/custom/main.sh index e8565ba..ed2e762 100755 --- a/custom/main.sh +++ b/custom/main.sh @@ -12,6 +12,7 @@ eval "${SCRIPTPATH}/install_docker.sh" eval "${SCRIPTPATH}/install_docker-compose.sh" eval "${SCRIPTPATH}/disable_swap.sh" eval "${SCRIPTPATH}/generate_ssh_cluster.sh" +eval "${SCRIPTPATH}/add_to_docker_group.sh" #eval "${SCRIPTPATH}/install_kubectl.sh" #eval "${SCRIPTPATH}/install_rke.sh"