一、安装
1、查看内核
uname -r2、更新包
sudo apt-get update3、没有docker旧版本,忽略这一步。如果有则需要卸载旧的版本,主要为了防止新旧版本冲突
sudo apt-get remove docker docker-engine docker.io containerd runc4、为了防止 apt 源使用 HTTPS 以确保软件下载过程中不被篡改。我们需要添加使用 HTTPS 传输的软件包及 CA 证书
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release5、确认下载软件包的合法性,需要添加软件源的 GPG 密钥,但因网络问题设置docker源改为国内源(阿里)
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg或
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -6、向 source.list 中添加 Docker CE 软件源
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"或使用https://mirrors.ustc.edu.cn源(失效)
sudo add-apt-repository "deb [arch=armhf] https://mirrors.ustc.edu.cn/docker-ce/linux/raspbian $(lsb_release -cs) stable"7、安装
sudo apt-get -y install docker.io或
sudo apt-get install docker-ce docker-ce-cli containerd.io启动docker
sudo systemctl start dockerdocker换源
修改 /etc/docker/daemon.json (如果该文件不存在,则创建)
{
    "registry-mirrors": [
        "https://hub-mirror.c.163.com"
    ]
}sudo systemctl daemon-reload && sudo systemctl restart docker            
                
            
        
                    
                    
评论 (0)