一、查看本机是否安装了Docker
警告:切勿在没有配置 Docker APT 源的情况下直接使用 apt 命令安装
1、系统要求
Docker CE 支持以下版本的 Ubuntu 操作系统:
- Eoan 19.10
- Bionic 18.04 (LTS)
- Xenial 16.04 (LTS)
Docker CE 可以安装在 64 位的 x86 平台或 ARM 平台上。Ubuntu 发行版中,LTS(Long-Term-Support)长期支持版本,会获得 5 年的升级维护支持,这样的版本会更稳定,因此在生产环境中推荐使用 LTS 版本。
养成一个良好的习惯,当你安装一个软件的时候优先检查自己的机器上是否安装了该软件,以及该软件的版本示什么,因为有的软件假如你已经安装了的话再次安装可能会发生意想不到的情况发生;
2、 机器上是否安装Docker查看:
查看命令:
sudo docker version

从上图可以发现机器上并没有找到任何和docker相关的版本信息,说明我们的机器是“干净”的。
小贴士: 这里除了可以使用版本查看来检测docker之外,还有一个其他方案就是:使用linux中的文件查找命令(find or
grep)查看是否有和docker相关的文件.
3、如何卸载旧版本的docker?
旧版本的 Docker 称为 docker 或者 docker-engine,使用以下命令卸载旧版本:
$ sudo apt-get remove docker \
docker-engine \
docker.io
二、使用 APT 安装
由于 apt 源使用 HTTPS 以确保软件下载过程中不被篡改。因此,我们首先需要添加使用 HTTPS 传输的软件包以及 CA 证书。
更新软件原:
sudo apt-get update
安装相应的软件包:
sudo apt-get install ca-certificates curl software-properties-common
安装速度还行,一分钟左右完成了。
ltwuyanlong@ubuntu:/$ sudo apt-get install ca-certificates curl software-properties-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
ca-certificates is already the newest version (20180409).
The following packages were automatically installed and are no longer required:
linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic linux-image-4.15.0-29-generic
linux-modules-4.15.0-29-generic linux-modules-extra-4.15.0-29-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libcurl4 libssl1.1 python3-dateutil python3-software-properties software-properties-gtk
The following NEW packages will be installed:
curl libcurl4 python3-dateutil
The following packages will be upgraded:
libssl1.1 python3-software-properties software-properties-common software-properties-gtk
4 upgraded, 3 newly installed, 0 to remove and 564 not upgraded.
Need to get 522 kB/1,822 kB of archives.
After this operation, 1,889 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcurl4 amd64 7.58.0-2ubuntu3.8 [214 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 curl amd64 7.58.0-2ubuntu3.8 [159 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 python3-dateutil all 2.6.1-1 [52.3 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 software-properties-common all 0.96.24.32.12 [10.0 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 software-properties-gtk all 0.96.24.32.12 [62.7 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 python3-software-properties all 0.96.24.32.12 [23.6 kB]
Fetched 522 kB in 36s (14.6 kB/s)
Preconfiguring packages ...
(Reading database ... 225922 files and directories currently installed.)
Preparing to unpack .../0-libssl1.1_1.1.1-1ubuntu2.1~18.04.5_amd64.deb ...
Unpacking libssl1.1:amd64 (1.1.1-1ubuntu2.1~18.04.5) over (1.1.0g-2ubuntu4.3) ...
Selecting previously unselected package libcurl4:amd64.
Preparing to unpack .../1-libcurl4_7.58.0-2ubuntu3.8_amd64.deb ...
Unpacking libcurl4:amd64 (7.58.0-2ubuntu3.8) ...
Selecting previously unselected package curl.
Preparing to unpack .../2-curl_7.58.0-2ubuntu3.8_amd64.deb ...
Unpacking curl (7.58.0-2ubuntu3.8) ...
Selecting previously unselected package python3-dateutil.
Preparing to unpack .../3-python3-dateutil_2.6.1-1_all.deb ...
Unpacking python3-dateutil (2.6.1-1
最低0.47元/天 解锁文章
1075

被折叠的 条评论
为什么被折叠?



