Skip to content

Instantly share code, notes, and snippets.

@laurobmb
Last active September 23, 2021 18:03
Show Gist options
  • Select an option

  • Save laurobmb/31535db298f973b4d455808f02a05e8c to your computer and use it in GitHub Desktop.

Select an option

Save laurobmb/31535db298f973b4d455808f02a05e8c to your computer and use it in GitHub Desktop.
#!/bin/bash
function InstallDocker(){
apt-get update
apt-get -y install apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get -y install docker-ce docker-ce-cli containerd.io
}
function InstallCompose(){
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version
}
# how to execute script
# bash <(curl -s URL )
# bash <(curl -s https://gist.githubusercontent.com/laurobmb/31535db298f973b4d455808f02a05e8c/raw/1400922048043e0dada126df4f7f518827b6c32d/InstallDockerUbuntu.sh )
InstallDocker
InstallCompose
docker run hello-world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment