Skip to content

Conversation

@LLdaniel
Copy link
Contributor

Description

With Debian Trixie released the new apt sources format RFC822 is now the default.
This PR proposes a way to take this new format into account.

The goal would be to have the follwoing docker.sources:

$ cat /etc/apt/sources.list.d/docker.sources 
Types: deb
URIs: https://download.docker.com/linux/debian/
Suites: trixie
Components: stable
Signed-By: /etc/apt/keyrings/docker.gpg

Related issues or tickets

#15382 and #23231

Reviews

I am happy to change my PR if needed. Currently I was not sure if we should keep both formats or make the new deb822 format as default.
Maybe we could move the legacy format into an info box?

@netlify
Copy link

netlify bot commented Aug 15, 2025

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit e1d7d33
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/69075e019188ea0008d58058
😎 Deploy Preview https://deploy-preview-23249--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added area/engine Issue affects Docker engine/daemon area/install Relates to installing a product labels Aug 15, 2025
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# Add the repository to Apt sources (new deb822 format, introduced with Trixie):

Choose a reason for hiding this comment

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

deb822 format was introduced in apt version 1.1 ten years before the release of Trixie

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh 😅 , thanks for that comment.
Did not know that, I can adjust the comment together with possible other review comments.

Maybe we should just say:

 # Add the repository to Apt sources (deb822 format)

Choose a reason for hiding this comment

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

Drop this comment and the use of non-deb822 format sources

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed with 7e2650e

(Hope it is still ok to keep the original comment, which just stated # Add the repository to Apt sources:. The paragraph seemed to me a bit lonely without the comment. At least explanations about (non-)deb822 are gone now).

URIs: https://download.docker.com/linux/debian/\n\
Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")\n\
Components: stable\n\
Signed-By: /etc/apt/keyrings/docker.gpg" | \
Copy link

Choose a reason for hiding this comment

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

Suggested change
Signed-By: /etc/apt/keyrings/docker.gpg" | \
Signed-By: /etc/apt/keyrings/docker.asc" | \

Just a typo correction

Choose a reason for hiding this comment

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

Wrong way around. This should be a machine-readable file not ASCII export.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All right, then .gpg should be fine. Kept that in the newest commit 7e2650e

Copy link

Choose a reason for hiding this comment

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

@LLdaniel @eshattow, the fact is, if you download an ASCII armored key, you have to dearmor it before using the binary version of the key.

So either you have to use the docker.asc (armored ASCII version), or you have to dearmor it first to get the binary docker.gpg version of the key!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for clarifying! Now I switched back to the originally used .asc.
But if you prefer gpg --dearmor I can also include that. Just let me know. 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, the armored version is much nicer for users to manage (and is what I personally use on my own systems).

Copy link
Contributor

Choose a reason for hiding this comment

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

For even more added context from the wiki page:

The reason why we avoid ASCII-Armored files is that they can only be used by SecureApt in version 1.4 or later (which appeared in stretch).

(even stretch LTS has been EOL since 2022, so we're extremely fine here)

make use of heredoc for better readability

Co-authored-by: David Karlsson <[email protected]>
Copy link
Contributor

@dvdksn dvdksn left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks. Maybe @thaJeztah / @tianon could you help double-check? 🙇

@eshattow
Copy link

eshattow commented Nov 3, 2025

Looks good to me, thanks. Maybe @thaJeztah / @tianon could you help double-check? 🙇

It is wrong though. Look at https://wiki.debian.org/DebianRepository/UseThirdParty for the recommendations how this should be done.

@tianon
Copy link
Contributor

tianon commented Nov 3, 2025

It looks fine to me for documentation given to users - @eshattow can you be more specific about what you'd change?

@tianon
Copy link
Contributor

tianon commented Nov 3, 2025

(I don't think you meant for them to, but your comments in this thread are coming off pretty aggressive FYI)

@stalb
Copy link

stalb commented Nov 3, 2025

@tianon, I think @eshattow just says it's better to use the de-armored version of the key (docker.gpg), since the ASCII-armored version will not work in versions older than Debian 12 or Ubuntu 22.04, which indeed is a real problem.

Simply add a line to generate the de-armored version of the key....

@eshattow
Copy link

eshattow commented Nov 4, 2025

It looks fine to me for documentation given to users - @eshattow can you be more specific about what you'd change?

There should not be ascii-armoured key installed to the user system. The guide recommended use of curl and sequoia are recent progressions to coincide with the stable release of Debian 13 Trixie.

(I don't think you meant for them to, but your comments in this thread are coming off pretty aggressive FYI)

I appreciate your code review. If the contributor for this pull request does not implement the required suggestions there is a pull request I have filed to get this done. I can follow up with any needed changes.

@tianon
Copy link
Contributor

tianon commented Nov 4, 2025

There should not be ascii-armoured key installed to the user system.

I'm not sure where you're getting such a strong exclusion from in that wiki page (if it's there, it's incorrect and should be fixed 😅).

From the relevant documentation in APT itself: 👀

https://manpages.debian.org/trixie/apt/apt-secure.8.en.html#USER_CONFIGURATION

Alternatively, keys may be placed in /etc/apt/keyrings for local keys, or /usr/share/keyrings for keys managed by packages, and then referenced by Signed-By: /etc/apt/keyrings/example-archive-keyring.asc option in a .sources file or using deb [signed-by=/etc/apt/keyrings/example-archive-keyring.asc] ... in the legacy .list format. This may be useful for APT versions prior to 2.4, which do not support embedded keys. ASCII-armored keys must use an extension of .asc, and unarmored keys an extension of .gpg.


the ASCII-armored version will not work in versions older than Debian 12 or Ubuntu 22.04

I'm confused by this - Ubuntu 20.04 is EOL (back in May), so 22.04 is the oldest Ubuntu that this needs to work on, and it does: 😅

$ docker run -it --rm --pull=always ubuntu:22.04
22.04: Pulling from library/ubuntu
Digest: sha256:09506232a8004baa32c47d68f1e5c307d648fdd59f5e7eaa42aaf87914100db3
Status: Image is up to date for ubuntu:22.04
root@ffb1c8368383:/# apt-get update &> /dev/null
root@ffb1c8368383:/# apt-get install -y ca-certificates curl &> /dev/null
root@ffb1c8368383:/# install -m 0755 -d /etc/apt/keyrings
root@ffb1c8368383:/# curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
root@ffb1c8368383:/# chmod a+r /etc/apt/keyrings/docker.asc
root@ffb1c8368383:/# tee /etc/apt/sources.list.d/docker.sources <<EOF
> Types: deb
> URIs: https://download.docker.com/linux/ubuntu
> Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
> Components: stable
> Signed-By: /etc/apt/keyrings/docker.asc
> EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: jammy
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
root@ffb1c8368383:/# apt-get update
Get:1 https://download.docker.com/linux/ubuntu jammy InRelease [48.5 kB]
Get:2 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages [70.3 kB]
Hit:3 http://archive.ubuntu.com/ubuntu jammy InRelease                         
Hit:4 http://security.ubuntu.com/ubuntu jammy-security InRelease               
Hit:5 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:6 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Fetched 119 kB in 43s (2767 B/s)
Reading package lists... Done

Similarly, Debian 11 is the oldest version of Debian that this needs to work on (even LTS for Debian 10 ended in June of 2024), and it does there too:

$ docker run -it --rm --pull=always debian:11
11: Pulling from library/debian
Digest: sha256:05bc4300f29708b0e6f4fa006ed3d16930baae91613416937c39e79dd9a095ac
Status: Image is up to date for debian:11
root@f7e21b97024e:/# apt-get update &> /dev/null
root@f7e21b97024e:/# apt-get install -y ca-certificates curl &> /dev/null
root@f7e21b97024e:/# install -m 0755 -d /etc/apt/keyrings
root@f7e21b97024e:/# curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
root@f7e21b97024e:/# chmod a+r /etc/apt/keyrings/docker.asc
root@f7e21b97024e:/# tee /etc/apt/sources.list.d/docker.sources <<EOF
> Types: deb
> URIs: https://download.docker.com/linux/debian
> Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
> Components: stable
> Signed-By: /etc/apt/keyrings/docker.asc
> EOF
Types: deb
URIs: https://download.docker.com/linux/debian
Suites: bullseye
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
root@f7e21b97024e:/# apt-get update
Hit:1 http://deb.debian.org/debian bullseye InRelease
Hit:2 http://deb.debian.org/debian-security bullseye-security InRelease
Hit:3 http://deb.debian.org/debian bullseye-updates InRelease
Get:4 https://download.docker.com/linux/debian bullseye InRelease [43.0 kB]
Get:5 https://download.docker.com/linux/debian bullseye/stable amd64 Packages [63.9 kB]
Fetched 107 kB in 0s (297 kB/s)     
Reading package lists... Done

So even with my "Debian hat" on, I think this change is great as-is and that recommending and using both deb822 and armored keys is very sane and very reasonable for all actively supported versions of both Debian and Ubuntu. 👍 🙇

@dvdksn dvdksn merged commit feec852 into docker:main Nov 4, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/engine Issue affects Docker engine/daemon area/install Relates to installing a product

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants