-
-
Save madkoding/3f9b02c431de5d748dfde6957b8b85ff to your computer and use it in GitHub Desktop.
#!/bin/bash | |
echo "Starting Docker installation on Deepin Linux..." | |
# Define a mapping from Deepin version to Debian version | |
map_deepin_to_debian() { | |
if [ "$1" -lt 20 ]; then | |
echo "stretch" | |
elif [ "$1" -ge 20 ]; then | |
echo "buster" | |
else | |
echo "Unknown version of Deepin" | |
exit 1 | |
fi | |
} | |
# Get Deepin version | |
DEEPIN_VERSION=$(grep 'VERSION_ID' /etc/os-release | cut -d '"' -f 2) | |
DEBIAN_VERSION=$(map_deepin_to_debian "$DEEPIN_VERSION") | |
echo "Deepin version: $DEEPIN_VERSION, using Debian version: $DEBIAN_VERSION for Docker installation." | |
# Update and install dependencies | |
echo "Updating packages and installing dependencies..." | |
sudo apt-get update -y | |
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common || { echo "Failed to install dependencies"; exit 1; } | |
# Check if Docker is installed and remove it | |
if dpkg -l | grep -qw docker; then | |
echo "Removing old Docker versions..." | |
sudo apt-get remove -y docker docker-engine docker.io containerd runc || { echo "Failed to remove existing Docker installations"; exit 1; } | |
fi | |
# Add Docker's official GPG key | |
echo "Adding Docker's GPG key..." | |
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - || { echo "Failed to add Docker's GPG key"; exit 1; } | |
# Verify key with fingerprint | |
sudo apt-key fingerprint 0EBFCD88 | |
# Add Docker repository | |
echo "Adding Docker repository for $DEBIAN_VERSION..." | |
printf "deb [arch=amd64] https://download.docker.com/linux/debian $DEBIAN_VERSION stable\n" | sudo tee /etc/apt/sources.list.d/docker-ce.list || { echo "Failed to add Docker repository"; exit 1; } | |
# Install Docker CE | |
echo "Installing Docker CE..." | |
sudo apt-get update -y | |
sudo apt-get install -y docker-ce || { echo "Failed to install Docker CE"; exit 1; } | |
# Add current user to the Docker group (optional) | |
echo "Adding current user to the Docker group..." | |
sudo usermod -aG docker $(whoami) || { echo "Failed to add user to Docker group"; exit 1; } | |
echo "Docker installation and setup completed successfully." |
hey people, i just a long time i'm no longer use deepin linux, so, if i need to update the script just tell me in the comments
you save my life !
thanks alot
work fine in deepin 20! thanks
This, fine sir is a very helpful script, thanks a lot !
It helped me thanks :) 👍 Beta Deeping Linux 23
Also I had to run another command before those, for work -> sudo nano /etc/*-release
and save the files with "Ctrl+O" (to save) and "Ctrl+x" (to quit)
The issue I had its solved here: elementary/os-patches#136
Updated script
my version to that worked on deepin V23 Beta2(Unstable)
https://gist.github.com/sacsbrainz/e6572da7238ed21d0cb8cab6b9b0480f
Replaced map_deepin_to_debian method, if lower version than 20 will use debian stretch, if equal or higher will use debian buster. That will be enough to work in deepin V23 Beta2 and future realeases
you're my hero
Dude Thanks!