Last active
November 5, 2021 12:37
-
-
Save IordanisKostelidis/879b5d1eff822a639034b82615dd61c1 to your computer and use it in GitHub Desktop.
Quick Docker Installation Script for new DigitalOcean Droplets on Ubuntu LTS
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
| #!/usr/bin/env bash | |
| # Set Variables for Docker | |
| DOCKER_GPG_URL="https://download.docker.com/linux/ubuntu/gpg" | |
| DOCKER_COMPOSE_VERSION="v2.1.0" | |
| # Remove older versions | |
| sudo apt-get remove -y docker docker-engine docker.io containerd runc | |
| # Update the catalog and install basic dependencies of docker | |
| sudo apt-get update \ | |
| && sudo apt-get install -y \ | |
| apt-transport-https \ | |
| ca-certificates \ | |
| curl \ | |
| gnupg-agent \ | |
| software-properties-common | |
| # Add Docker's GPG key | |
| curl -fsSL "${DOCKER_GPG_URL}" | sudo apt-key add - | |
| sudo apt-key fingerprint 0EBFCD88 | |
| # Add Docker's Repository | |
| sudo add-apt-repository \ | |
| "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
| $(lsb_release -cs) \ | |
| stable" | |
| # Update the Catalogue and install Docker | |
| sudo apt-get update \ | |
| && sudo apt-get install -y docker-ce docker-ce-cli containerd.io | |
| # Install Docker Compose | |
| DOCKER_COMPOSE_RELEASE_BASE_URL="https://github.com/docker/compose/releases/download" | |
| DOCKER_COMPOSE_DISTRO_FILE="docker-compose-$(uname -s)-$(uname -m)" | |
| DOCKER_COMPOSE_URL="${DOCKER_COMPOSE_RELEASE_BASE_URL}/${DOCKER_COMPOSE_VERSION}/${DOCKER_COMPOSE_DISTRO_FILE}" | |
| sudo curl -L "${DOCKER_COMPOSE_URL}" -o /usr/local/bin/docker-compose \ | |
| && sudo chmod +x /usr/local/bin/docker-compose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment