Way to the science

登陆节点临时使用http代理方法

由于网络原因,如果需要访问被拦截的资源,可以使用以下方法为登陆节点的ssh实例设置http/https代理:
export https_proxy=http://192.168.33.7:7890
export http_proxy=http://192.168.33.7:7890

可通过以下链接管理:
http://192.168.33.7:9091/?hostname=192.168.33.7&port=9090&secret=123456#/proxies

  1. 如何为特定docker容器设置代理:
    Portainer–>Containers–>xxxcontainer–>Duplicate/Edit–>添加以下ENV
    HTTP_PROXY=http://192.168.33.7:7890
    HTTPS_PROXY=http://192.168.33.7:7890
    http_proxy=http://192.168.33.7:7890
    https_proxy=http://192.168.33.7:7890
    由于linux对case敏感,因此需要同时import大小写的变量!

  2. 对于sudo命令需要修改sudo配置文件或:
    sudo https_proxy=http://192.168.33.7:7890 http_proxy=http://192.168.33.7:7890 command xxx

Leave a comment

Your email address will not be published. Required fields are marked *