mirror of https://gitlab.com/hp3icc/emq-TE1.git
Update docker.sh
This commit is contained in:
parent
d67abd1837
commit
a636e2b875
|
|
@ -1,64 +1,67 @@
|
|||
#!/bin/sh
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
whiptail --title "ADN server" --msgbox "Debe ejecutar este script como usuario ROOT" 0 50
|
||||
whiptail --title "Docker Install" --msgbox "Debe ejecutar este script como usuario ROOT" 0 50
|
||||
exit 0
|
||||
fi
|
||||
(crontab -l | grep -v "sync ; echo 3 > /proc/sys/vm/drop_caches >/dev/null 2>&1") | crontab -
|
||||
cpu_info=$(cat /proc/cpuinfo)
|
||||
is_raspberry=false
|
||||
is_supported_arch=false
|
||||
#!/bin/bash
|
||||
|
||||
# Buscar información de CPU
|
||||
if [[ $cpu_info =~ "Raspberry" ]]; then
|
||||
is_raspberry=true
|
||||
fi
|
||||
echo "Installing required packages..."
|
||||
echo "Install Docker Community Edition..."
|
||||
|
||||
if [[ $is_raspberry == true ]]; then
|
||||
# Buscar información de arquitectura
|
||||
arch=$(uname -m)
|
||||
|
||||
if [[ $arch == "aarch64" ]]; then
|
||||
is_supported_arch=true
|
||||
fi
|
||||
# Eliminar versiones antiguas de Docker si las hay, ignorando errores si no existen
|
||||
apt-get -y remove docker docker-engine docker.io containerd runc --ignore-missing
|
||||
|
||||
if [[ $is_supported_arch == true ]]; then
|
||||
echo "Arquitectura de Raspberry Pi $arch"
|
||||
echo "Instalando ADN server"
|
||||
else
|
||||
echo "La arquitectura de la Raspberry Pi, no es compatible. Se requiere aarch64."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Instalando ADN server"
|
||||
fi
|
||||
######################################
|
||||
bash -c "$(curl -fsSLk https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/ipv6off.sh)" &&
|
||||
echo ADN-DMR-Peer-Server Docker installer...
|
||||
# Actualizar el índice de paquetes
|
||||
apt-get -y update
|
||||
|
||||
echo Installing required packages...
|
||||
echo Install Docker Community Edition...
|
||||
apt-get -y remove docker docker-engine docker.io &&
|
||||
apt-get -y update &&
|
||||
apt-get -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common &&
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - &&
|
||||
ARCH=`/usr/bin/arch`
|
||||
echo "System architecture is $ARCH"
|
||||
if [ "$ARCH" == "x86_64" ]
|
||||
then
|
||||
# Instalar paquetes necesarios para Docker (forzar sin intervención)
|
||||
apt-get -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common
|
||||
|
||||
# Descargar y agregar la clave GPG oficial de Docker, sobrescribiendo si es necesario
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor --batch --yes -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||
|
||||
# Detectar la arquitectura del sistema
|
||||
ARCH=$(dpkg --print-architecture)
|
||||
echo "System architecture is $ARCH"
|
||||
|
||||
# Ajustar el nombre de la arquitectura según sea necesario
|
||||
if [ "$ARCH" == "amd64" ]; then
|
||||
ARCH="amd64"
|
||||
elif [ "$ARCH" == "arm64" ]; then
|
||||
ARCH="arm64"
|
||||
elif [ "$ARCH" == "armhf" ]; then
|
||||
ARCH="armhf"
|
||||
else
|
||||
echo "Architecture $ARCH not supported"
|
||||
exit 1
|
||||
fi
|
||||
add-apt-repository \
|
||||
"deb [arch=$ARCH] https://download.docker.com/linux/debian \
|
||||
$(lsb_release -cs) \
|
||||
stable" &&
|
||||
apt-get -y update &&
|
||||
apt-get -y install docker-ce &&
|
||||
|
||||
echo Install Docker Compose...
|
||||
apt-get -y install docker-compose &&
|
||||
# Agregar el repositorio de Docker para la arquitectura correcta
|
||||
echo "Adding Docker repository for $ARCH..."
|
||||
echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
|
||||
echo Set userland-proxy to false...
|
||||
cat <<EOF > /etc/docker/daemon.json &&
|
||||
# Actualizar el índice de paquetes nuevamente
|
||||
apt-get -y update
|
||||
|
||||
# Instalar Docker Community Edition, forzando la instalación sin preguntas
|
||||
apt-get -y install docker-ce docker-ce-cli containerd.io
|
||||
|
||||
# Verificar la instalación de Docker
|
||||
echo "Docker installed successfully!"
|
||||
docker --version
|
||||
|
||||
echo "Install Docker Compose..."
|
||||
|
||||
# Instalar Docker Compose, forzando la instalación sin preguntas
|
||||
apt-get -y install docker-compose
|
||||
|
||||
# Verificar la instalación de Docker Compose
|
||||
docker-compose --version
|
||||
|
||||
# Configurar Docker con opciones personalizadas, sobrescribiendo si es necesario
|
||||
echo "Set userland-proxy to false and configure log options..."
|
||||
cat <<EOF | sudo tee /etc/docker/daemon.json > /dev/null
|
||||
{
|
||||
"userland-proxy": false,
|
||||
"experimental": true,
|
||||
|
|
@ -70,5 +73,8 @@ cat <<EOF > /etc/docker/daemon.json &&
|
|||
}
|
||||
EOF
|
||||
|
||||
echo Restart docker...
|
||||
systemctl restart docker
|
||||
# Reiniciar el servicio Docker para aplicar cambios
|
||||
echo "Restarting Docker service..."
|
||||
sudo systemctl restart docker
|
||||
|
||||
echo "Docker setup completed successfully!"
|
||||
|
|
|
|||
Loading…
Reference in New Issue