本文主要是介绍docker 安装(unbuntu安装),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
替换源
有时候因为墙的原因,总是不成功,因此我们直接将apt源换成阿里云的
阿里云ubuntu镜像源
需要在阿里云找到指定版本的源,我这里是Ubuntu20
sudo vim /etc/apt/sources.list
更换内容(可以先将sources.list备份)
deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiversedeb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiversedeb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse# deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiversedeb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
更新
sudo apt-get -y update
docker安装
也会碰到墙的问题,因此也直接用阿里云的源,
阿里云docker-ce安装
step 1: 安装必要的一些系统工具
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
step 2: 安装GPG证书
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
Step 3: 写入软件源信息
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
Step 4: 更新并安装Docker
sudo apt-get -y update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
测试
sudo docker run hello-world
这篇关于docker 安装(unbuntu安装)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!