Skip to content

Instantly share code, notes, and snippets.

@tuytoosh
Last active September 11, 2023 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tuytoosh/b700f17f3ee3ad7f20d533e61de31c56 to your computer and use it in GitHub Desktop.
Save tuytoosh/b700f17f3ee3ad7f20d533e61de31c56 to your computer and use it in GitHub Desktop.
Install Docker and Docker Compose with one command, and run it without sudo :)
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done &&
sudo apt-get update &&
sudo apt-get install ca-certificates curl gnupg &&
sudo install -m 0755 -d /etc/apt/keyrings &&
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg &&
sudo chmod a+r /etc/apt/keyrings/docker.gpg &&
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update &&
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin &&
sudo groupadd docker &&
sudo usermod -aG docker $USER &&
newgrp docker &&
sudo docker run hello-world
@tuytoosh
Copy link
Author

tuytoosh commented Sep 11, 2023

If you don't want to copy such a long command you can easily run this one:

 /bin/bash -c "$(curl -s https://gist.githubusercontent.com/tuytoosh/b700f17f3ee3ad7f20d533e61de31c56/raw)"

It downloads the gist and runs the commands after getting root password.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment