universal-docker: initial release

This commit is contained in:
aptalca
2020-10-23 12:03:41 -04:00
parent ca3be57894
commit 2f381e5872
7 changed files with 86 additions and 76 deletions
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/with-contenv bash
echo "**** installing docker and docker compose ****"
if [ -f /usr/bin/apt ]; then
DISTRONAME="ubuntu"
else
DISTRONAME="alpine"
fi
ARCH=$(uname -m)
if [ -f "/docker-compose-${DISTRONAME}/docker-compose_${ARCH}" ] ; then
echo "Copying over docker and docker-compose binaries"
mv "/docker-compose-${DISTRONAME}/docker-compose_${ARCH}" /usr/local/bin/docker-compose
mv "/docker-compose-${DISTRONAME}/docker_${ARCH}" /usr/local/bin/docker
chmod +x /usr/local/bin/docker-compose
rm -rf /docker-compose-ubuntu /docker-compose-alpine
else
echo "**** docker and docker-compose already installed, skipping ****"
fi
if [ -S /var/run/docker.sock ]; then
DOCKER_GID=$(stat -c '%g' "/var/run/docker.sock")
if id -G abc | grep -qw "$DOCKER_GID"; then
exit 0
else
DOCKER_NAME=$(getent group "${DOCKER_GID}" | awk -F: '{print $1}')
if [ -z "${DOCKER_NAME}" ]; then
DOCKER_NAME="dockergroup"
groupadd -g "${DOCKER_GID}" "${DOCKER_NAME}"
fi
usermod -aG "${DOCKER_NAME}" abc
fi
elif [ -n "$DOCKER_HOST" ]; then
echo "**** /var/run/docker.sock is not mapped, therefore, docker client will only work with a remote docker service ****"
else
echo "**** Please map /var/run/docker.sock for access to docker service on host. Alternatively you can manually define a remote host address with the docker cli option -H ****"
fi
-27
View File
@@ -1,27 +0,0 @@
#!/usr/bin/with-contenv bash
# Determine if setup is needed
if [ ! -f /usr/local/lib/python***/dist-packages/sshuttle ] && \
[ -f /usr/bin/apt ]; then
## Ubuntu
apt-get update
apt-get install --no-install-recommends -y \
iptables \
openssh-client \
python3 \
python3-pip
pip3 install sshuttle
fi
if [ ! -f /usr/lib/python***/site-packages/sshuttle ] && \
[ -f /sbin/apk ]; then
# Alpine
apk add --no-cache \
iptables \
openssh \
py3-pip \
python3
pip3 install sshuttle
fi
chown -R root:root /root
chmod -R 600 /root/.ssh
-3
View File
@@ -1,3 +0,0 @@
#!/usr/bin/with-contenv bash
sshuttle --dns --remote root@${HOST}:${PORT} 0/0 -x 172.17.0.0/16