1. Ubuntu Proxy Link to heading

  1. v2rayn

    Open v2rayn, set up the proxy, and get the proxy port.

    [socks:: 10808] | [http:: 10809] # Local ports
    127.0.0.1 # Remote port
    
  2. UI Proxy (excluding terminal)
    This is not very useful and can be left off, but if you need to enable it, follow these steps:
    Go to Settings -> Network -> Proxy -> Manual -> Set proxy port.

    Ubuntu Proxy Setup
  3. Host Machine Terminal + Conda + Pip + Git + Apt Proxy Settings
    You can remove the unnecessary parts of the script if you don’t need them for certain tools.
    Click here for the script🔗

  4. Docker Development Container Inherits Proxy
    This step only inherits the host machine’s proxy settings to ensure the proxy works inside the container. Environment variables for tools like Conda still need to be set (see step 5).

    a. Modify the devcontainer.json file:

    {
      // (1) Inherit environment variables from the host machine. If the host has ALL_PROXY set, the container will use the proxy. If the host doesn't have ALL_PROXY, the container won't use a proxy. This is the typical setup.
      "name": "My DevContainer",
      "build": {
        "dockerfile": "Dockerfile"
      },
      "runArgs": [
        "--network=host"
      ],
      "remoteEnv": {
        "ALL_PROXY": "${localEnv:ALL_PROXY}",
        "HTTP_PROXY": "${localEnv:HTTP_PROXY}",
        "HTTPS_PROXY": "${localEnv:HTTPS_PROXY}"
      }
    }
    // (2) Directly set the proxy
    {
      "name": "My DevContainer",
      "build": {
        "dockerfile": "Dockerfile"
      },
      "runArgs": [
        "--network=host"
      ],
      "remoteEnv": {
        "ALL_PROXY": "socks5://127.0.0.1:10808",
        "HTTP_PROXY": "http://127.0.0.1:10809",
        "HTTPS_PROXY": "http://127.0.0.1:10809"
      }
    }
    

    b. Host machine terminal setup:

    export ALL_PROXY="socks5://127.0.0.1:10808" # Set proxy
    export HTTP_PROXY="http://127.0.0.1:10809"
    export HTTPS_PROXY="http://127.0.0.1:10809"
    code . # Open VSCode
    

    c. Restart the container:

    Ctrl + Shift + P -> Select "Remote-Containers: Rebuild and Reopen in Container"
    
    echo $HTTP_PROXY # Verify proxy settings
    echo $HTTPS_PROXY
    echo $ALL_PROXY 
    curl -I https://www.google.com # Check proxy status
    
  5. Set Proxy for Conda/Pip/Git/Apt Inside Docker Container
    You can remove any parts of the script that are unnecessary for your setup.
    Click here for the script🔗

2. Windows Proxy Link to heading

todo