Last active
September 11, 2023 07:42
-
-
Save hamidhaghdoost/b700f17f3ee3ad7f20d533e61de31c56 to your computer and use it in GitHub Desktop.
Install Docker and Docker Compose with one command, and run it without sudo :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you don't want to copy such a long command you can easily run this one:
It downloads the gist and runs the commands after getting root password.