Skip to content

Conversation

@MichaIng
Copy link

@MichaIng MichaIng commented Feb 14, 2021

Proposed changes

"the 64-bit version of one of these Debian or Raspbian versions" might be confusing, since there is no 64-bit Raspbian, which is naturally an armv6hf (32-bit) only repository. The 64-bit Raspberry Pi OS uses the regular arm64 Debian repository. Remove the 64-bit mention from this sentence, as the supported architectures are listed below. Add "Raspbian Buster" explicitly to the supported OS list.

Do not use the deprecated "apt-key" command to add the repository key. Use "gpg --dearmor" instead to install the key as separate file into /etc/apt/trusted.gpg.d/. This fixes issue #11851.
The deprecation warning can be seen e.g. in the Debian man pages: https://manpages.debian.org/testing/apt/apt-key.8.en.html

Do not use the "add-apt-repository" command to add the repository list. It does not work on Raspbian, due to a missing template file: RPi-Distro/repo#160
Moreover, the passed command line arguments are the exact content that needs to be added to the list file, hence can be used with a simple "echo".

EDIT: Fixed/implemented with: #11990

The manual repository install can be done on Raspbian as well, but the URL path needs to be adjusted. Since "lsb_release" cannot be used to print the distribution ID in lower case, to not add further string manipulation commands, instructions for Debian and Raspbian are separated into two tabs. The three tabs for the three supported package architectures have been merged by using "$(dpkg --print-architecture)". A note has been added to replace this command substitution, if a foreign architecture is wanted. It could be removed completely to let DPkg choose the native architecture automatically, or the next best added foreign architecture, if the native one is not provided by the repository. With this change, the method can be used on Raspbian, hence the information about which method is supported by which distribution, has been removed.

Do not expect the lsb_release command to be present, add the lsb-release package to the dependency list instead. "software-properties-common" is not required anymore as "add-apt-repository" is not used. To assure that the "gpg" command is available and the key can be handled by the system, add the "gnupg" package as well.
EDIT: Fixed/implemented with: #11990

The apt-cache madison docker-ce example output has been updated to show current packages available on Debian Buster.

To support Debian and Raspbian, the MkDocs "download-url-base" variable has been truncated and "/debian" resp. "/raspbian" needs to be added literally when calling it.

The leading free spaces from the docker.list creation commands have been removed:

$ echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] {{ download-url-base }}/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

=>

$ echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] {{ download-url-base }}/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

The reason is what with the spaces inside of the double quoted part, when copying the code, it will create additional free spaces inside of the resulting list file. IMO the leading command prompt sign $ could be removed as well, as it should be clear enough that it is a console command block, and this would enable one to copy the whole block. MkDocs even allows to add a little copy button to the top-right of the block. But that is a design choice as well, so I left it as it is.

@netlify
Copy link

netlify bot commented Feb 14, 2021

Deploy preview for docsdocker ready!

Built with commit f59f4d9

https://deploy-preview-12331--docsdocker.netlify.app

@netlify
Copy link

netlify bot commented Feb 14, 2021

Deploy preview for docsdocker ready!

Built with commit 2081ad1

https://deploy-preview-12331--docsdocker.netlify.app

@MichaIng
Copy link
Author

I recognised #11990 too late. As mentioned here I suggest to merge #11990 first and I'll merge and fix conflicts here afterwards to keep the tabs/support restructure for Raspbian.

"the 64-bit version of one of these Debian or Raspbian versions" might be confusing, since there is no 64-bit Raspbian, which is naturally an armv6hf (32-bit) only repository. The 64-bit Raspberry Pi OS uses the regular arm64 Debian repository. Remove the 64-bit mention from this sentence, as the supported architectures are listed below. Add "Raspbian Buster" explicitly to the supported OS list.

Do not use the deprecated "apt-key" command to add the repository key. Use "gpg --dearmor" instead to install the key as separate file into /etc/apt/trusted.gpg.d/. This fixes issue #11851.
The deprecation warning can be seen e.g. in the Debian man pages: https://manpages.debian.org/testing/apt/apt-key.8.en.html

Do not use the "add-apt-repository" command to add the repository list. It does not work on Raspbian, due to a missing template file: RPi-Distro/repo#160
Moreover, the passed command line arguments are the exact content that needs to be added to the list file, hence can be used with a simple "echo". On Raspbian, the URL path needs to be adjusted. Since "lsb_release" cannot be used to print the distribution ID in lower case, instructions for Debian and Raspbian are separated into two tabs. The three tabs for the three supported package architectures have been merged via "$(dpkg --print-architecture)". A note has been added to replace this command substitution, if a foreign architecture is wanted. It may be removed completely to let DPkg choose the native architecture automatically, or the next best added foreign architecture, if the native one is not provided by the repository. With this change, the method can be used on Raspbian, hence the information about which method is supported by which distribution, has been removed.

Do not expect the "lsb_release" command to be present, add the "lsb-release" package to the dependency list instead. "software-properties-common" is not required anymore as "add-apt-repository" is not used. To assure that the "gpg" command is available and the key can be handled by the system, add the "gnupg" package as well.

The "apt-cache madison docker-ce" example output has been updated to show current packages available on Debian Buster.

To support Debian and Raspbian, the MkDocs "download-url-base" variable has been truncated and "/debian" resp. "/raspbian" needs to be added literally to when calling it.

Signed-off-by: MichaIng <micha@dietpi.com>
@MichaIng
Copy link
Author

MichaIng commented Mar 2, 2021

Okay, the PR has been updated to include and resolve conflicts with #11990. It's main purpose is now to enable the manual repository key and list install on Raspbian, which is generally working pretty fine.

When the content itself is approved, I'll squash the commits and update the commit text.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Overall this looks good. Looks like it needs another rebase (minor conflict because of #12425), and I left some comments inline

I did a quick compare between the debian and ubuntu pages, and now that Debian, Raspbian and Ubuntu are very close w.r.t. instructions, I think we should consider;

  • Using an include file for the "bigger" part of the instructions
  • The include file could use take some parameters ("Distro name" (Ubuntu/Debian/Raspbian)
  • Perhaps some blocks (apt-cache madison exampleoutput) made "conditional" based on that
  • Move Raspbian to its own page; this makes it easier to find, and (although Raspbian and Debian are very similar), could make the instructions even more easier to follow (and with the template/include, it wouldn't introduce a lot of extra maintenance to have two pages)
  • It would also fix some of the minor inconsistencies (e.g. currently we point to https://download.docker.com/linux/debian/gpg, but could point to https://download.docker.com/linux/raspbian/gpg, although the content of those are likely always gonna be the same)

Comment on lines +101 to +105
> **Note**: The `dpkg --print-architecture` sub-command below returns the native
> package architecture of your Debian distribution, such as `arm64`. If you want to install
> Docker for a foreign package architecture, replace `$(dpkg --print-architecture)`
> with e.g. `armhf` or `arm64`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should keep this note; would this be a common situation? Perhaps we should keep this as an exercise for the "advanced user", as it would likely not be a standard situation.

Reason why I'm leaning towards removing it, is that the "notes" (targeting non-standard situations) now take up more space than the actual instructions for the "standard" case;

Screenshot 2021-03-02 at 16 49 29

If we do think it's useful, perhaps we should move it inside each tab, and as a "non note", e.g.

The instruction above automatically configures the package repository for your
machine's native architecture. If you want to install Docker for a foreign
package architecture, replace `$(dpkg --print-architecture)` with the desired
architecture, such as `armhf` or `arm64`.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As stated above, IMO the "arch=" tag could be removed, leaving it up to DPkg to simply pull the native architecture of the installed OS/distro. Especially with dpkg --print-architecture the outcome should be exactly the same. If someone has some special setup, where parts of the system intentionally consists of different architecture binaries, one must have known about that "arch=" tag before and will know if/how to apply it. But using it, matches to what the installer does: https://github.com/docker/docker-install/blob/master/install.sh#L379

Else I agree that the notes take too much space, so removing only the note about it should be fine as well. I added it mainly to be consistent with the note about the lsb_release command substitution note.

An alternative would be collapsible notes, if you have the pymdownx.details Markdown extension enabled?

Could be achieved with <details><summary> HTML5 tags manually as well.

If we do think it's useful, perhaps we should move it inside each tab,

But this doesn't "solve" the issue that the notes are much larger than the command block and adds the inconsistency that dpkg --print-architecture is explained inside the tab, while lsb_release is explained outside, even that for both basically the same is true: It is fine in 99% of cases and in the remaining rare cases, admin must have known already about their limitation on that system 😉.

Copy link
Author

@MichaIng MichaIng Apr 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thaJeztah
To push this a bit:

  • I played with the details tag and it would require some more CSS to make it nice, which is out of scope for this PR.
  • Moving the note as text into the tab doubles the code and does not solve the issue that text blocks are larger than the command block. If only the blue note style is to prominent, then we could also un-note the two notes and leave them where they are.
  • I personally do not like to use two command substitutions but explain only one of them. Either we explain both or none, would be my very personal preference 😄. But I follow your preference, of course!

I finally suggest to remove dpkg --print-architecture completely, the note and also the code.

It is a no-op, as DPkg anyway installs packages for the major architecture (output of dpkg --print-architecture), even if the version was lower. Only if a package is not available for the major architecture, it looks into foreign architecture lists. Declaring the architecture explicitly would break that automatic behaviour, even that it is most likely wanted: Hypothetically a new ARMv9 architecture may be created that is backwards-compatible to ARMv8=arm64 and the Docker repo does not yet ship binaries for it. If arm64 is added as foreign architecture, without declaring the architecture in the list file, DPkg would automatically install the arm64 package that runs on that system. If arm64 were incompatible with that hypothetical ARMv9 CPU, then the admin would not add arm64 as foreign architecture, so that APT/DPkg would error out with a meaningful error message.

@MichaIng
Copy link
Author

MichaIng commented Mar 2, 2021

Indeed, practically Ubuntu and Debian in this case are not further away from each other than Raspbian and Debian are. It's basically the distro path element in the repository URL, and of course the example apt-cache madison outputs nothing more, isn't it?

We had a similar discussion for our docs, whether very similar instructions should get their own page/tab or share the same with tabs only where they differ, the first being easier to maintain and the second easier to follow for users. Your idea with the includes actually sounds good. So you mean a shared template for Ubuntu, Debian and Raspbian, and then the differing blocks as includes and the differing single strings as variables or so? Sounds great, but you'll know better what is possible with your build software.

Also having a dedicated "Raspbian" page/link in the navigation likely makes Raspberry Pi users find it more certain to be the right docs for their system.

It would also fix some of the minor inconsistencies (e.g. currently we point to https://download.docker.com/linux/debian/gpg, but could point to https://download.docker.com/linux/raspbian/gpg, although the content of those are likely always gonna be the same)

At first I had two tabs for that as well, but actually it's the same key anyway, even the one inside the ubuntu dir is the same. Sadly the Fedora-family key is a different one, otherwise https://download.docker.com/linux/gpg could be used to have one key for all distros 🙂.

MichaIng and others added 2 commits April 24, 2021 14:54
as not all browsers all horizontal scroll bars on long <code> lines

Co-authored-by: Sebastiaan van Stijn <thaJeztah@users.noreply.github.com>
@craig-osterhout craig-osterhout added the area/install Relates to installing a product label Aug 4, 2022
@crazy-max crazy-max deleted the branch docker:master October 25, 2022 09:08
@crazy-max crazy-max closed this Oct 25, 2022
@usha-mandya
Copy link
Member

@MichaIng Thanks for the PR. The master branch has been renamed to main. Some of the existing PRs have been automatically closed as a result of this change. Could you create a new PR against our latest docs if the suggested changes are still relevant? Thank you.

@MichaIng
Copy link
Author

Jep, it got many conflicts anyway. I'll review current docs and in case redo the PR when I find time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install Relates to installing a product

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants