Skip to content

Conversation

@Wenzel
Copy link

@Wenzel Wenzel commented Oct 24, 2025

Description

The curl command needs the -E flag with sudo to preserve environment variables, particularly HTTP_PROXY and HTTPS_PROXY settings. Without this flag, users behind corporate proxies cannot download Docker's GPG key.

The curl command needs the -E flag with sudo to preserve environment variables, particularly HTTP_PROXY and HTTPS_PROXY settings. Without this flag, users behind corporate proxies cannot download Docker's GPG key.
@Wenzel Wenzel requested a review from dvdksn as a code owner October 24, 2025 14:38
@netlify
Copy link

netlify bot commented Oct 24, 2025

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit 95f4af9
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/68fb8f6ea0fe960008a98e02
😎 Deploy Preview https://deploy-preview-23604--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 Oct 24, 2025
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL {{% param "download-url-base" %}}/gpg -o /etc/apt/keyrings/docker.asc
sudo -E curl -fsSL {{% param "download-url-base" %}}/gpg -o /etc/apt/keyrings/docker.asc
Copy link
Member

Choose a reason for hiding this comment

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

Wondering if we should change this so that curl isn't executed as root;

curl -fsSL "{{% param "download-url-base" %}}/gpg" | sudo tee /etc/apt/keyrings/docker.asc > /dev/null

or with an intermediate file, but that requires a cleanup after;

curl -fsSL "{{% param "download-url-base" %}}/gpg" -o docker.asc
sudo install -o root -g root -m 0644 docker.asc /etc/apt/keyrings/docker.asc
rm -f docker.asc

@dvdksn @vvoland any thoughts? If we change, we should also update the debian.md accordingly

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, we previously agreed that sudo curl was an acceptable tradeoff - see https://github.com/docker/docs/pull/19138/files#r1467055019

I think sudo -E curl still seems OK to me but no strong opinions. If not sudo curl then I'd go for sudo tee > /dev/null

Copy link
Contributor

@vvoland vvoland Oct 29, 2025

Choose a reason for hiding this comment

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

Not a big deal I think, but if we want something shorter than tee we could use: sudo cat - >/etc/apt/keyrings/docker.asc

or sudo cat ->/etc/apt/keyrings/docker.asc if we want to be funny and use the cat goes to operator (which is a close relative to the "downto" operator in C)

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.

4 participants