一、在ubuntu18.04上安装
1、更新索引包和安装相关依赖:
sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
2、 导入源仓库的 GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
3、将 Docker APT 软件源添加到你的系统:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
4、更新索引包和安装相关依赖
sudo apt update
sudo apt install docker-ce
5、确认docker是否安装成功
root用户登录
docker --version
非root用户登录:
sudo docker --version
sudo usermod -aG docker $USER
echo "$USER"
6、参考链接
这个只是安装最新版的教程:https://zhuanlan.zhihu.com/p/90474818
这个包括安装指定版本docker以及卸载https://zhuanlan.zhihu.com/p/143156163
二、安装过程中遇到的问题
1、安装过程中 Malformed entry xx in list file /etc/apt/sources.list (URI parse)
这个的意思是:列表文件/etc/apt/sources.list中格式错误的条目xx(URI解析),其实就是在/etc/apt/sources.list中第xx行有错误。我是在复制的别人的命令的时候复制错了
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo add-apt-repository "deb [arch=amd64] Index of linux/ubuntu/ $(lsb_release -cs) stable"
2、Certificate verification failed: The certificate is NOT trusted.
这个问题的话,我也不知道是什么原因,我的解决办法是把/etc/apt/sources.list全部替换成了,下面的链接,然后重新从第一步开始。
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
修改前记得备份sources.list
cp sources.list sourcesBackup.list
参考链接:https://blog.csdn.net/weixin_40294256/article/details/85133677
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)