更新apt仓库
安装系统工具
1
| sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
|
安装gpg证书
1
| curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
|
添加docker软件源
1
| sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
|
安装docker
1
| sudo apt-get install docker-ce docker-ce-cli containerd.io
|
运行docker
查看docker版本,验证是否安装成功
如果输出结果中同时显示client和server就说明安装成功了
配置阿里云加速
1 2 3 4 5 6 7 8 9 10 11
| sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors":["https://n5jclonh.mirror.aliyuncs.com"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker
#查看是否添加成功 cat /etc/docker/daemon.json
|