Friday, January 7, 2022

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

Issue

Today I upgraded docker successfully, following instructions from: https://askubuntu.com/questions/472412/how-do-i-upgrade-docker .

However, when I opened the repository url https://get.docker.com/ubuntu/ in my browser, it is just a text page, which contains a list of bash commands.

My question is :

  • How apt works with this text page url?

  • Does apt simply run the bash commands?

  • If so, why is there a same command:

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

as that in https://askubuntu.com/questions/472412/how-do-i-upgrade-docker


Solution

The page located at https://get.docker.com/ubuntu/ contains a script that can be used to install 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

But this script is not used by apt-get, it must be run manually.

The script creates the config file /etc/apt/sources.list.d/docker.list with the following content:

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

When apt-get update is run, this config file will be used and apt-get update will take that line and build the following URL from it

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

The packages cache of the packages management system will be updated with the packages described in the Packages file.

Package: lxc-docker
Version: 1.5.0
License: Apache-2.0
Vendor: none
Architecture: amd64
Maintainer: [email protected]
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.
....

Finally apt-get upgrade will download and install the packages.



Answered By - Ortomala Lokni