Skip to content

Instantly share code, notes, and snippets.

@zetc0de
Forked from myugan/docker-setup.sh
Last active September 19, 2020 11:04
Show Gist options
  • Save zetc0de/ba9277281bdc6e30ae4ddd179fc39b25 to your computer and use it in GitHub Desktop.
Save zetc0de/ba9277281bdc6e30ae4ddd179fc39b25 to your computer and use it in GitHub Desktop.
Setup Docker and Compose on Ubuntu 18.04 machine
#!/bin/bash
red="\e[1;31m"
reset="\033[00m"
# Install dependency
echo -e "$red Installing dependencies...$reset"
apt install -y apt-transport-https ca-certificates curl software-properties-common
# Add GPG key
echo -e "$red Add GPG key...$reset"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Add docker repository to APT sources
echo -e "$red Add docker repository...$reset"
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" -y
# Install docker community edition
echo -e "$red Installing docker...$reset"
apt update
apt install -y docker-ce
echo -e "$red Add user to docker group...$reset"
sudo usermod -aG docker $USER
# Testing docker
echo -e "$red Testing Hello World...$reset"
docker run hello-world
# Download docker-compose
echo -e "$red Install docker-compose...$reset"
curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment