I'm in a strange position where the apt-get update
works and can connect to the internet although nothing else works in a Docker container.
I'm not sure if I have put the proxies in the wrong place or I am missing something else.
For the apt-get I add the following to the /etc/apt/apt.conf
and it works.
Acquire::http::proxy "http://user:[email protected].*.*:80/";
Acquire::ftp::proxy "ftp://user:[email protected].*.*:80/";
Acquire::https::proxy "https://user:[email protected].*.*:80/";
Although since also placing the credentials in the correct (I think) pattern / format in /etc/profile
I cannot get commands such as curl
or ping
to work.
Is there something I might be missing?
Type env | grep proxy
, if it returns nothing then exporting proxies might help:
export https_proxy=https://user:[email protected].*.*:80
export http_proxy=http://user:[email protected].*.*:80
export ftp_proxy=ftp://user:[email protected].*.*:80
If your user's default shell is bash or another Bourne compatible shell, then interactive login shells will read from the global /etc/profile and /etc/profile.d/*.sh and /etc/bash.bashrc files. Interactive non-login shells will also read from the global /etc/bash.bashrc file.
Creating a /etc/profile.d/proxy.sh file with the http_proxy, https_proxy, and ftp_proxy environment variables set should make those values available to most programs the next time you log in.
Here is an example proxy.sh file where the http, https, and ftp proxy is the same:
export http_proxy=http://my.local.proxy:port
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
Some login methods might skip those files so if it doesn't work, you could try putting them in /etc/bash.bashrc so that each new interactive shell you open has those values set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With