Skip to content

Instantly share code, notes, and snippets.

@dryleaf
Forked from shivekkhurana/install-docker.sh
Created April 3, 2022 06:59
Show Gist options
  • Save dryleaf/27e39150163e5ea452f7968d15a70cc6 to your computer and use it in GitHub Desktop.
Save dryleaf/27e39150163e5ea452f7968d15a70cc6 to your computer and use it in GitHub Desktop.
Install Docker and Docker Compose on a Ubuntu Machine (Tested on AWS)
#!/bin/sh
set -eu
# Docker
sudo apt remove --yes docker docker-engine docker.io || true
sudo apt update
sudo apt --yes --no-install-recommends install apt-transport-https ca-certificates
wget --quiet --output-document=- https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release --codename --short) stable" \
sudo apt update
sudo apt --yes --no-install-recommends install docker-ce
sudo usermod --append --groups docker "$USER"
sudo systemctl enable docker
printf '\nDocker installed successfully\n\n'
printf 'Waiting for Docker to start...\n\n'
sleep 3
# Docker Compose
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
printf '\nDocker Compose installed successfully\n\n'
docker-compose --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment