Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
在 ubuntu 安装 docker
# step 1: 安装必要的一些系统工具
apt-get update
apt-get install -y \
ca-certificates \
curl \
gnupg \
# step 2: 安装GPG证书
mkdir -p /etc/apt/keyrings
curl -fsSL | 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] \
$(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 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