From 82f168efa6789d8cc92f294548fd45d47b729def Mon Sep 17 00:00:00 2001 From: Bateast Date: Fri, 1 Nov 2024 21:19:21 +0000 Subject: [PATCH] docker_install_V1.0.sh Mise en ligne du script d'installation des services Docker, Docker Compose et Portainer --- docker_install.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 docker_install.sh diff --git a/docker_install.sh b/docker_install.sh new file mode 100644 index 0000000..c37f7bf --- /dev/null +++ b/docker_install.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# Mettre à jour les paquets +echo "Mise à jour des paquets..." +sudo apt update -y +sudo apt upgrade -y + +# Installation de Docker +echo "Installation de Docker..." +sudo apt install -y ca-certificates curl gnupg lsb-release + +# Ajouter la clé GPG officielle de Docker +sudo mkdir -p /etc/apt/keyrings +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg + +# Ajouter le dépôt Docker +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + +# Installation de Docker Engine +echo "Installation de Docker Engine..." +sudo apt update -y +sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin + +# Vérification de l'installation de Docker +echo "Vérification de Docker..." +sudo systemctl enable docker +sudo systemctl start docker +sudo docker --version + +# Installation de Docker Compose (standalone) +echo "Installation de Docker Compose..." +DOCKER_COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*?(?=")') +sudo curl -L "https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose +sudo chmod +x /usr/local/bin/docker-compose +docker-compose --version + +# Installation de Portainer +echo "Installation de Portainer..." +sudo docker volume create portainer_data +sudo docker run -d -p 8000:8000 -p 9443:9443 \ + --name=portainer --restart=always \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v portainer_data:/data \ + portainer/portainer-ce:latest + +echo "Installation terminée ! Docker, Docker Compose et Portainer sont maintenant installés." +echo "Accédez à Portainer via https://votre_ip:9443 pour l'interface de gestion."