question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proxy variables not set in alpine VM /etc/environment

See original GitHub issue

Rancher Desktop Version

1.0.0-beta.1

Rancher Desktop K8s Version

1.23.1

What operating system are you using?

macOS

Operating System / Build Version

Big Sur 11.6

What CPU architecture are you using?

x64

Windows User Only

No response

Actual Behavior

Proxy environment variables are not set in alpine VM /etc/environment. When trying to run/pull images, the image cannot be pulled from a repository due to proxy issues.

This has been fixed in Lima, at least for Lima’s default Ubuntu VM.

In my environment, my proxy variables are set in .bashrc, pointing to a proxy machine on the local network. System proxies “System Preferences -> Network -> Wifi (or other active interface) -> Advanced -> Proxies” are set via my organizations automatic proxy configuration script.

Steps to Reproduce

On a network which requires use of a proxy:

  • Install Rancher Desktop 1.0.0-beta1 with ‘containerd’ as runtime.
  • nerdtcl run --rm hello-world

Result

Fetching remote images times out, due to proxy.

Expected Behavior

Proxy variables should be set in the Alpine VM in /etc/environment. This allows images to be fetched.

WORK AROUND: Start Rancher Desktop, wait for VM to be up an running, then execute this command:

set | grep -iE '^[a-z]*_proxy=' | ssh \
     -p $(awk '/localPort/ {print $2}' < ~/Library/Application\ Support/rancher-desktop/lima/0/lima.yaml) \
     -i ~/Library/Application\ Support/rancher-desktop/lima/_config/user \
     localhost 'sudo bash -c "cat >> /etc/environment; /etc/init.d/k3s restart"'

After running this command, remote images can be fetched as usual.

Additional Information

Consider adding a new “Proxies” tab, or section on “Troubleshooting” to manually enter proxy variables, Allow multiple variables to be set, one per line in the form of:

http_proxy=http://myproxy:1234
https_proxy=http://myproxy:1234
socks_proxy=http://myproxy:1234
etc.

“Apply” button should validate the proxy variables by: coercing the variable names as all lower case, using the regexp ‘^[a-z]*_proxy=’, duplicate the variable name as upper case, and copy the resulting lines to the VM /etc/environment. Proxy values should be accepted as is, which will allow for userid:password, if needed, e.g., “http_proxy=http://userid:pass@myproxy:1234

The resulting lines in /etc/environment should look like:

http_proxy=http://myproxy:1234
HTTP_PROXY=http://proxy:1234
etc.

After setting /etc/environment, restart k3s by executing “/etc/environment /etc/init.d/k3s restart”’

These steps should also be applied when starting Rancher Desktop after a power up, or after “Factory Reset”.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
mnoworzyncommented, Mar 1, 2022

We will really like to have the GUI configuration:

Consider adding a new “Proxies” tab, or section on “Troubleshooting” to manually enter proxy variables

As we work almost entirely remotely we often turn on and off the corporate VPN and have to enable/disable the proxy settings therefore a “Proxies” tab that remembers the settings even if the proxy is disabled would be most helpful.

2reactions
pboushycommented, Mar 16, 2022

As y’all consider adding a GUI to handle proxies, one thing that would be AMAZING is if y’all made it where we can provide a host that is only available when the proxy is available, and it configures the env variables when that host is reachable.

This would allow companies who have to use a proxy on the internal network, but not outside the network to work flawlessly without issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sudo do not respect environment variables for proxy (#10356)
I have a setup with proxy enabled. Everything works fine in root shell and for ordinary user. Running `sudo` brings problem as the...
Read more >
How to set up proxy using http_proxy & https_proxy ...
How to set up proxy on Linux using http_proxy and https_proxy environment variable. Export the variables or set using /etc/environment and /etc/profile.d ...
Read more >
Setting variable in /etc/environment has no effect - Super User
Most likely the best solution is to have your start up process create environment variables from /etc/environment but that advice is given ...
Read more >
Install Docker on Windows (WSL) without Docker Desktop
For anyone struggling with using this behind a proxy, I found the only configuration file that dockerd looks at is /etc/environment , so...
Read more >
Qualys Cloud Agent for Linux Installation Guide
If 'no_proxy' is set, curl will not use proxy even if any proxy environment variable is set. Here are the steps to enable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found