在 ubuntu 安装 docker
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 | |
# step 1: 安装必要的一些系统工具 | |
apt-get update | |
apt-get install -y \ | |
ca-certificates \ | |
curl \ | |
gnupg \ | |
lsb-release | |
# step 2: 安装GPG证书 | |
mkdir -p /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
chmod a+r /etc/apt/keyrings/docker.gpg | |
# Step 3: 写入软件源信息 | |
echo \ | |
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null | |
# Step 4: 更新并安装 Docker-CE | |
apt-get update | |
apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin | |
# 5. 启动 | |
service docker start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment