原文网址:Docker--Ubuntu使用apt-get安装Docker_IT利刃出鞘的博客-CSDN博客
简介
本文介绍在Ubuntu中安装Docker的方法。
1.卸载旧版本Docker
旧版本的 Docker 称为 docker 或者 docker-engine,使用以下命令卸载旧版本:
sudo apt-get remove \ docker-ce \ docker-ce-cli \ containerd.io \ docker \ docker-engine \ docker.io2.安装HTTPS相关软件
sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg \ lsb-release3.安装GPG证书
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -4.添加docker源
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"移除源的命令:
sudo add-apt-repository -r "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"5.安装 Docker
更新 apt 软件包,并安装 docker
sudo apt-get updatesudo apt-get install docker-ce docker-ce-cli containerd.io6.测试 Docker 是否安装正确
执行命令:
docker version若能正常输出以上信息,则说明安装成功。
7.修改用户组
需要修改用户组,否则执行命令会报错,比如:
- docker version报错:Got permission denied while trying to connect to the Docker daemon socket
- dovker ps报错:permission denied while trying to connect to the Docker daemon socket
修改用户组的方法是: 这里
问题解决
找不到docker-ce包
见:Ubuntu之apt-get--解决安装docker的报错:Package docker-ce is not available, but is referred to by another p_IT利刃出鞘的博客-CSDN博客
缺少公钥
见:Ubuntu之apt-get--解决The following signatures couldn‘t be verified because the public key is not avai_IT利刃出鞘的博客-CSDN博客