Skip to content

Instantly share code, notes, and snippets.

@marcosricardoss
Last active August 30, 2023 18:43
Show Gist options
  • Save marcosricardoss/7b52d8c1870b0c58dec35f22abe75050 to your computer and use it in GitHub Desktop.
Save marcosricardoss/7b52d8c1870b0c58dec35f22abe75050 to your computer and use it in GitHub Desktop.
Docker Installer
#!/usr/bin/env bash
# update the apt package index and install packages to allow apt to use a repository over HTTPS:
sudo apt-get update -y
sudo apt-get install ca-certificates curl gnupg -y
sudo apt-get install python3-pip
# add Docker’s official GPG key:
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
# set up the repository:
echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# install docker engine
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo docker run hello-world
# docker-compose
pip install -U docker-compose
docker-compose --version
# add the current user to the docker group.
sudo groupadd docker
sudo usermod -aG docker $USER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment