Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bootstrap docker and compose on new machine
#!/bin/bash
# Run like
# $ curl https://gist.githubusercontent.com/mraaroncruz/a3c19e4b901846bea872e5f24e617d55/raw/2948b92e094215542c9679a9384694c5c6e5e9dd/install_docker_and_compose.bash | bash
set -e
setup () {
### Update the apt package index:
sudo apt update
sudo apt upgrade -y
### Install packages to allow apt to use a repository over HTTPS:
sudo apt -y install \
apt-transport-https \
ca-certificates \
curl \
git \
software-properties-common
# Install docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt update
sudo apt -y install docker-ce
# Install docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
}
echo "## Installing docker and docker-compose ##" && setup
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment