安装Docker 容器
参考官网信息:
https://docs.docker.com/install/linux/docker-ce/ubuntu/
设置存储库
-
更新 apt 包索引:
$ sudo apt-get update
-
通过 HTTPS 使用存储库安装软件包:
$ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common
-
添加 Docker 的官方 GPG 密钥:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
通过搜索指纹的最后 8 个字符,验证您现在拥有指纹 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 的密钥
$ sudo apt-key fingerprint 0EBFCD88 # 展示结果: pub rsa4096 2017-02-22 [SCEA] 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 uid [ unknown] Docker Release (CE deb) <docker@docker.com> sub rsa4096 2017-02-22 [S]
-
使用以下命令设置稳定存储库。
以下二选一:
# 1(官方源配置) $ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" # 2(阿里源配置) $ sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
注:lsb_release -cs 命令无效请使用:
$ apt-get update && apt-get install -y lsb-release && apt-get clean all
以上安装命令无效请使用以下方法:
-
$ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
安装 Docker容器:
-
更新 apt 包索引:
$ sudo apt-get update
-
安装最新版本的 Docker 容器:
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
结果展示:
卸载docker应用:
$ apt-get autoremove docker-ce docker-ce-cli containerd.io
$ rm -rf /var/lib/docker
注意:1、apt-get autoremove 命令慎用,此处可使用;
2、apt-get autoremove将文件依赖删除,存在进入不了ubuntu桌面系统的可能
3、尽量使用apt-get remove(卸载软件包 )或 apt-get purge (卸载软件包并清除软件包的配置)
文章来源与实践,转载请标注来源,谢谢你的阅读 apt-get autoremove卸载依赖慎用(有一天突然进不了系统,怀恋下这个命令)