为什么 "https://get.docker.com/ubuntu" 是 apt 存储库?

Why "https://get.docker.com/ubuntu" is a apt repository?

今天我 升级 docker 成功,遵循来自 https://askubuntu.com/questions/472412/how-do-i-upgrade-docker 的说明。

但是,当我在浏览器中打开存储库 url https://get.docker.com/ubuntu/ 时,它只是一个文本页面,其中包含 bash commands 的列表。

我的问题是:

"echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list"

就像在 https://askubuntu.com/questions/472412/how-do-i-upgrade-docker

如果我没记错的话(我还是Linux的新手),
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
它复制 http://get.docker.io/ubuntu 中的文本文件,然后将其粘贴到 etc/apt/sources.list.d/docker.list。然后执行 shell 文件。

位于 https://get.docker.com/ubuntu/ 的页面包含可用于安装 docker

的脚本
# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
    apt-get update
    apt-get install -y apt-transport-https
fi

# Add the repository to your APT sources
echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list

# Then import the repository key
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

# Install docker
apt-get update
apt-get install -y lxc-docker

但是这个脚本不是apt-get使用的,必须运行手动

脚本创建配置文件 /etc/apt/sources.list.d/docker.list,内容如下:

deb https://get.docker.com/ubuntu docker main

apt-get update 为 运行 时,将使用此配置文件并且 apt-get update 将采用该行并从中构建以下 URL

https://get.docker.com/ubuntu/dists/docker/main/binary-amd64/Packages

包管理系统的包缓存将使用 Packages 文件中描述的包进行更新。

Package: lxc-docker
Version: 1.5.0
License: Apache-2.0
Vendor: none
Architecture: amd64
Maintainer: support@docker.com
Installed-Size: 0
Depends: lxc-docker-1.5.0
Homepage: http://www.docker.com/
Priority: extra
Section: default
Filename: pool/main/l/lxc-docker/lxc-docker_1.5.0_amd64.deb
Size: 2092
SHA256: 2e8b061216cc45343197e52082175bc671af298d530652436dc16d0397f986f0
SHA1: 24a0314bd7f6fdf79b69720de60be77510d689af
MD5sum: 923cad1a2af2d6b0a3e8fa909ba26ca4
Description: Linux container runtime Docker complements LXC with a high-level API which operates at the process level. It runs unix processes with strong guarantees of isolation and repeatability across servers. Docker is a great building block for automating distributed systems: large-scale web deployments, database clusters, continuous deployment systems, private PaaS, service-oriented architectures, etc.
....

最后 apt-get upgrade 将下载并安装软件包。