Skip to content

Instantly share code, notes, and snippets.

@abr4xas
Last active June 30, 2021 23:33
Show Gist options
  • Save abr4xas/973c5923551996f77d0443ca38b6fdb4 to your computer and use it in GitHub Desktop.
Save abr4xas/973c5923551996f77d0443ca38b6fdb4 to your computer and use it in GitHub Desktop.
Script para configurar docker en sistemas basados en debian.
#!/bin/bash
#
# Viernes, Junio 28/2018
# Developed by angel <[email protected]>
if [[ $USER != root ]]; then
echo "############################################"
echo "# Error: Debe tener privilegios de ROOT ###"
echo "##########################################"
exit 1
fi
set -eu
export DEBIAN_FRONTEND=noninteractive
#
# verificamos si tenemos Docker.
command -v docker >/dev/null 2>&1 || {
echo >&2 "Configurando requisitos para Docker..."
apt-get update --fix-missing > /dev/null 2>&1
curl -sSL https://get.docker.com/ | sh > /dev/null 2>&1
sleep 4.0
echo >&2 "Listo..."
}
#
# configurando docker-compose
command -v docker-compose >/dev/null 2>&1 || {
echo >&2 "Configurando docker-compose"
COMPOSE_VERSION=$1
curl -L https://github.com/docker/compose/releases/download/$COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose > /dev/null 2>&1
chmod +x /usr/local/bin/docker-compose
sleep 4.0
echo >&2 "Listo..."
}
echo >&2 "Configurando usuario en el grupo docker..."
sudo usermod -aG docker ${USER}
sleep 4.0
echo >&2 "Listo..."
echo "#############################################"
echo "## Se ha configurado el sistema con Docker #"
echo "###########################################"
exit 0;

Usar

Se recomienda que el usuario tenga privilegios de root:

sudo chmod +x docker-config.sh

Ir a https://github.com/docker/compose/releases y tomar la version del stable release que al momento es 1.21.2 y pasarla como argumento al script

sudo ./docker-config.sh 1.21.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment