Created
July 18, 2023 07:14
-
-
Save DancinParrot/d1cbc279e4d4bfabeae067b8d78a8849 to your computer and use it in GitHub Desktop.
Docker quick setup for Debian
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
#!/bin/bash | |
# Docker quick setup for Debian | |
if [[ $(id -u) == 0 ]]; then | |
echo "Running as root" | |
echo "Get updates..." && apt-get update | |
echo "Install dependencies..." && apt-get install ca-certificates curl gnupg | |
echo "Adding Docker's GPG key..." && install -m 0755 -d /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
chmod a+r /etc/apt/keyrings/docker.gpg | |
echo "Setting up Docker repository..." | |
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" | \ | |
tee /etc/apt/sources.list.d/docker.list > /dev/null | |
echo "Install Docker Engine..." | |
apt-get update && apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | |
echo "Testing Docker..." && docker run hello-world | |
echo "Done!" | |
else | |
echo "Please run as root" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment