栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

ubuntu18.04安装docker以及过程中遇到的问题

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

ubuntu18.04安装docker以及过程中遇到的问题

一、在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用户登录

#1.执行docker --version查看版本信息
docker --version
#显示Docker version 20.10.10, build b485636基本上就安装成功了 

非root用户登录:

#需要加上sudo进行查看
sudo docker --version
#然后把你的用户加入docker用户组
sudo usermod -aG docker $USER
#$USER是你登录的用户名,我执行的就是sudo usermod -aG docker indulge
#通过下面的命令可以看到登录的用户名
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"

#这里面的Index of linux是一个链接,我是直接复制的所以出了错误
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-src 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-src 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-src 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
# deb-src 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

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/451187.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号