Hallo, what is the right way to set a proxy systemwide using centos 7? I need this for wget and docker. My first idea was /etc/environment but allthough the proxy is set wget and docker don? t connect to their target-systems. Thanks for hints Ralf
Stephen John Smoogen
2019-Jan-05 19:28 UTC
[CentOS] how to set proxy systemwide (wget and docker)
On Sat, 5 Jan 2019 at 09:28, Ralf Prengel <ralf.prengel at rprengel.de> wrote:> > Hallo, > what is the right way to set a proxy systemwide using centos 7? > I need this for wget and docker. > My first idea was /etc/environment but allthough the proxy is set wget and docker don? t connect to their target-systems. >How are you doing it in /etc/environment? And how is the process calling wget and docker getting initiated? The data in /etc/environment should be set if the process is in a PAM aware environment, but I would expect that there may be ways where you could not get it set. The other place to put it would be in /etc/profile.d/proxy.sh and /etc/profile.d/proxy.<fill in here> but that would require also the shells sourcing those files not to clear out their environment variables or to make sure they source /etc/profile.d when starting up.> Thanks for hints > > Ralf > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos-- Stephen J Smoogen.
> Hallo, > what is the right way to set a proxy systemwide using centos 7? > I need this for wget and docker. > My first idea was /etc/environment but allthough the proxy is set wget and > docker don? t connect to their target-systems.I have this in /etc/profile.d/proxy-config.sh: -----%<--------------------------------- PROXYHOST="proxy" PROXYPORT="8080" for CFGFILE in /etc/sysconfig/proxy-config ${HOME}/.proxy-config; do [ -s $CFGFILE ] && . $CFGFILE done export http_proxy="http://${PROXYHOST}:${PROXYPORT}" export HTTP_PROXY="http://${PROXYHOST}:${PROXYPORT}" export https_proxy="http://${PROXYHOST}:${PROXYPORT}" export HTTPS_PROXY="http://${PROXYHOST}:${PROXYPORT}" export ftp_proxy="http://${PROXYHOST}:${PROXYPORT}" export FTP_PROXY="http://${PROXYHOST}:${PROXYPORT}" export all_proxy="http://${PROXYHOST}:${PROXYPORT}" export ALL_PROXY="http://${PROXYHOST}:${PROXYPORT}" export no_proxy="localhost,$(hostname -s),$(hostname -f),$(hostname -d),127.0.0.1" export NO_PROXY="localhost,$(hostname -s),$(hostname -f),$(hostname -d),127.0.0.1" export RSYNC_PROXY="${PROXYHOST}:${PROXYPORT}" unset PROXYHOST PROXYPORT CFGFILE -----%<--------------------------------- Regards, Simon
Zitat von Simon Matter via CentOS <centos at centos.org>:>> Hallo, >> what is the right way to set a proxy systemwide using centos 7? >> I need this for wget and docker. >> My first idea was /etc/environment but allthough the proxy is set wget and >> docker don? t connect to their target-systems. > > I have this in /etc/profile.d/proxy-config.sh:Hallo, works perfect for wget. Docker fails [root at srvdockerndxx tmp]# docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.10 http://192.168.x.y/v1/scripts/811F51C097F763ABA2E5:1546214400000:Nzpsvk8sbaKXle3QYotSNzUFk Unable to find image 'rancher/agent:v1.2.10' locally Trying to pull repository docker.io/rancher/agent ... /usr/bin/docker-current: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers). See '/usr/bin/docker-current run --help'. [root at srvdockerndxx tmp]# Seems as if docker needs more or other proxy-configurations. Ralf
Zitat von Simon Matter via CentOS <centos at centos.org>:>> Hallo, >> what is the right way to set a proxy systemwide using centos 7? >> I need this for wget and docker. >> My first idea was /etc/environment but allthough the proxy is set wget and >> docker don? t connect to their target-systems.Hallo, https://forums.docker.com/t/docker-installing-docker-behind-a-proxy-on-centos-7-error-while-pulling-image/26015 solves my problem. Ralf