Skip to content

Instantly share code, notes, and snippets.

@AntonioCS
Last active November 16, 2021 13:54
Show Gist options
  • Save AntonioCS/16f6c30eb5e5b6f05f4aaa5d368fb0a5 to your computer and use it in GitHub Desktop.
Save AntonioCS/16f6c30eb5e5b6f05f4aaa5d368fb0a5 to your computer and use it in GitHub Desktop.
Install docker and docker-compose on linux host
#!/bin/bash
#RUN THIS SCRIPT AS ROOT
#https://docs.docker.com/engine/install/ubuntu/
apt-get remove docker docker-engine docker.io containerd runc
apt-get update
apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update
apt-get -y install docker-ce docker-ce-cli containerd.io
#docker-compose
#https://docs.docker.com/compose/install/
curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
#https://docs.docker.com/engine/install/linux-postinstall/
groupadd docker
#NOTE: replace ubuntu with the user you want
sudo usermod -aG docker {$USER}
newgrp docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment