Created
January 25, 2024 07:10
-
-
Save dazeb/4793b5a1877664835116e1f3665b61d9 to your computer and use it in GitHub Desktop.
Docker & Docker-Compose v2 Bash Install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install Docker | |
echo -e "\n\nInstalling Docker..." | |
sh <(curl -sSL https://get.docker.com) | |
if [ $? -eq 0 ]; then | |
echo -e "\033[0;32mDocker installation succeeded.\033[0m" | |
else | |
echo -e "\033[0;31mDocker installation failed.\033[0m" | |
exit 1 | |
fi | |
# Install Docker Compose | |
echo -e "\n\nInstalling Docker Compose..." | |
LATEST=$(curl -sL https://api.github.com/repos/docker/compose/releases/latest | grep '"tag_name":' | cut -d'"' -f4) | |
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} | |
mkdir -p $DOCKER_CONFIG/cli-plugins | |
curl -sSL https://github.com/docker/compose/releases/download/$LATEST/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose | |
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose | |
docker compose version | |
if [ $? -eq 0 ]; then | |
echo -e "\033[0;32mDocker Compose installation succeeded.\033[0m" | |
else | |
echo -e "\033[0;31mDocker Compose installation failed.\033[0m" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment