-
Notifications
You must be signed in to change notification settings - Fork 8k
Add sudo -E flag to curl command for proxy support #23604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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.
✅ Deploy Preview for docsdocker ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| 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 |
There was a problem hiding this comment.
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/nullor 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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
Description
The curl command needs the
-Eflag with sudo to preserve environment variables, particularlyHTTP_PROXYandHTTPS_PROXYsettings. Without this flag, users behind corporate proxies cannot download Docker's GPG key.