在 apt 安装的时候可能会疑惑怎么有这么多种 docker,并且读 docker 官方目录的时候还要卸载另外的,并称其他为 “过时的”,然而可能却并不是那么过时以至于导致兼容性问题。
一句话概括:docker-ce 由 docker.com,docker-io 由 Debian 提供,安装更加方便,只需一行命令,并且我也推荐用 docker-io。
docker-io包是 Debian/Ubuntu 从其官方仓库上提供的 docker 版本使用的名称。每个外部依赖项都是一个单独的包,并且将独立更新。
docker-ce是docker.com直接提供的认证版本,也可以从源代码构建。因此,在构建之前将所有依赖项拉入源代码树,然后整个应用形成一个单独的包。总是一次更新 docker 及其所有依赖项。
在 Ubuntu 20.04 干跑 dry-run 对比:
36 行,docker-ce 的版本是 20.10.12
docker-ce apt 安装 >folded1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| $ sudo apt-get install docker-ce --dry-run Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: linux-headers-5.4.0-26 linux-headers-5.4.0-26-generic linux-headers-5.4.0-47 linux-headers-5.4.0-47-generic linux-headers-5.4.0-81 linux-headers-5.4.0-81-generic linux-headers-5.4.0-86 linux-headers-5.4.0-86-generic linux-image-5.4.0-26-generic linux-image-5.4.0-47-generic linux-image-5.4.0-81-generic linux-image-5.4.0-86-generic linux-modules-5.4.0-26-generic linux-modules-5.4.0-47-generic linux-modules-5.4.0-81-generic linux-modules-5.4.0-86-generic linux-modules-extra-5.4.0-26-generic linux-modules-extra-5.4.0-47-generic linux-modules-extra-5.4.0-81-generic linux-modules-extra-5.4.0-86-generic Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: containerd.io dbus-user-session docker-ce-cli docker-ce-rootless-extras docker-scan-plugin pigz slirp4netns Suggested packages: aufs-tools cgroupfs-mount | cgroup-lite The following NEW packages will be installed: containerd.io dbus-user-session docker-ce docker-ce-cli docker-ce-rootless-extras docker-scan-plugin pigz slirp4netns 0 upgraded, 8 newly installed, 0 to remove and 19 not upgraded. Inst pigz (2.4-1 Ubuntu:20.04/focal [amd64]) Inst containerd.io (1.4.12-1 Docker CE:focal [amd64]) Inst dbus-user-session (1.12.16-2ubuntu2.1 Ubuntu:20.04/focal-updates, Ubuntu:20.04/focal-security [amd64]) Inst docker-ce-cli (5:20.10.12~3-0~ubuntu-focal Docker CE:focal [amd64]) Inst docker-ce (5:20.10.12~3-0~ubuntu-focal Docker CE:focal [amd64]) Inst docker-ce-rootless-extras (5:20.10.12~3-0~ubuntu-focal Docker CE:focal [amd64]) Inst docker-scan-plugin (0.12.0~ubuntu-focal Docker CE:focal [amd64]) Inst slirp4netns (0.4.3-1 Ubuntu:20.04/focal [amd64]) Conf pigz (2.4-1 Ubuntu:20.04/focal [amd64]) Conf containerd.io (1.4.12-1 Docker CE:focal [amd64]) Conf dbus-user-session (1.12.16-2ubuntu2.1 Ubuntu:20.04/focal-updates, Ubuntu:20.04/focal-security [amd64]) Conf docker-ce-cli (5:20.10.12~3-0~ubuntu-focal Docker CE:focal [amd64]) Conf docker-ce (5:20.10.12~3-0~ubuntu-focal Docker CE:focal [amd64]) Conf docker-ce-rootless-extras (5:20.10.12~3-0~ubuntu-focal Docker CE:focal [amd64]) Conf docker-scan-plugin (0.12.0~ubuntu-focal Docker CE:focal [amd64]) Conf slirp4netns (0.4.3-1 Ubuntu:20.04/focal [amd64])
|
37 行,docker.io 的版本是 20.10.7
docker.io apt 安装 >folded1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| $ sudo apt-get install docker.io --dry-run Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: linux-headers-5.4.0-26 linux-headers-5.4.0-26-generic linux-headers-5.4.0-47 linux-headers-5.4.0-47-generic linux-headers-5.4.0-81 linux-headers-5.4.0-81-generic linux-headers-5.4.0-86 linux-headers-5.4.0-86-generic linux-image-5.4.0-26-generic linux-image-5.4.0-47-generic linux-image-5.4.0-81-generic linux-image-5.4.0-86-generic linux-modules-5.4.0-26-generic linux-modules-5.4.0-47-generic linux-modules-5.4.0-81-generic linux-modules-5.4.0-86-generic linux-modules-extra-5.4.0-26-generic linux-modules-extra-5.4.0-47-generic linux-modules-extra-5.4.0-81-generic linux-modules-extra-5.4.0-86-generic Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: bridge-utils containerd dns-root-data dnsmasq-base pigz runc ubuntu-fan Suggested packages: ifupdown aufs-tools btrfs-progs cgroupfs-mount | cgroup-lite debootstrap docker-doc rinse zfs-fuse | zfsutils The following NEW packages will be installed: bridge-utils containerd dns-root-data dnsmasq-base docker.io pigz runc ubuntu-fan 0 upgraded, 8 newly installed, 0 to remove and 19 not upgraded. Inst pigz (2.4-1 Ubuntu:20.04/focal [amd64]) Inst bridge-utils (1.6-2ubuntu1 Ubuntu:20.04/focal [amd64]) Inst runc (1.0.1-0ubuntu2~20.04.1 Ubuntu:20.04/focal-updates [amd64]) Inst containerd (1.5.5-0ubuntu3~20.04.1 Ubuntu:20.04/focal-updates [amd64]) Inst dns-root-data (2019052802 Ubuntu:20.04/focal [all]) Inst dnsmasq-base (2.80-1.1ubuntu1.4 Ubuntu:20.04/focal-updates, Ubuntu:20.04/focal-security [amd64]) Inst docker.io (20.10.7-0ubuntu5~20.04.2 Ubuntu:20.04/focal-updates, Ubuntu:20.04/focal-security [amd64]) Inst ubuntu-fan (0.12.13 Ubuntu:20.04/focal [all]) Conf pigz (2.4-1 Ubuntu:20.04/focal [amd64]) Conf bridge-utils (1.6-2ubuntu1 Ubuntu:20.04/focal [amd64]) Conf runc (1.0.1-0ubuntu2~20.04.1 Ubuntu:20.04/focal-updates [amd64]) Conf containerd (1.5.5-0ubuntu3~20.04.1 Ubuntu:20.04/focal-updates [amd64]) Conf dns-root-data (2019052802 Ubuntu:20.04/focal [all]) Conf dnsmasq-base (2.80-1.1ubuntu1.4 Ubuntu:20.04/focal-updates, Ubuntu:20.04/focal-security [amd64]) Conf docker.io (20.10.7-0ubuntu5~20.04.2 Ubuntu:20.04/focal-updates, Ubuntu:20.04/focal-security [amd64]) Conf ubuntu-fan (0.12.13 Ubuntu:20.04/focal [all])
|
可以看出版本差别并不大,兼容性日常使用应该可以忽略。考虑国内网络环境,直接安装 docker.io 从 apt 镜像源下载/更新更快。
docker-ee 现在被收购,一般用不上。
参考