更新 Apt 源
获取 GPG 公钥
依次执行:
1
| sudo apt-get install ca-certificates curl
|
1
| sudo install -m 0755 -d /etc/apt/keyrings
|
1
| sudo curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
|
1
| sudo chmod a+r /etc/apt/keyrings/docker.asc
|
因为 Docker 官方目前被 ban 了,无法通过国内的网络直接访问,所以这里用了阿里云的镜像。
配置 Apt 源
再接着执行:
1
2
3
4
| echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] http://mirrors.aliyun.com/docker-ce/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
安装 Docker
1
| sudo apt-get install docker-ce docker-ce-cli docker-compose-plugin
|