OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

Support a user-serviceable way to configure http/https proxy in the sandbox

Open barsuna opened this issue 9 months ago • 1 comments

What problem or use case are you trying to solve?

When the environment where OpenDevin runs is behind proxy the sandbox has trouble accessing the internet. Things like pip install are not functioning as a result.

Proxy can be passed via env vars to the main OD container, but not to the sandbox container

Describe the UX of the solution you'd like

Pass certain env vars to the sandbox when it is started. (For proxy one may need HTTP_PROXY, http_proxy, HTTPS_PROXY, https_proxy, no_proxy, ...)

Do you have thoughts on the technical implementation?

for example can use a prefix such as OD_SB_ (as in OpenDevin SandBox) which will allow OD to find variables to pass to the sandbox container as environment

i.e.

OD_SB_HTTP_PROXY would pass HTTP_PROXY env var to the sandbox (any other notation is fine as well, this is just off the cuff example)

Describe alternatives you've considered

Currently the only alternative i found is to patch exec_box.py/ssh_box.py

    ...
    245             self.container = self.docker_client.containers.run(
    246                 self.container_image,
    247                 command='tail -f /dev/null',
>>  248                 environment={'https_proxy':'http://myproxy.local:80'},
    ...

which is not really user-serviceable

Additional context

barsuna avatar May 08 '24 10:05 barsuna

good advice.

iFurySt avatar May 08 '24 12:05 iFurySt

As of 0.5.3, you can set env vars like SANDBOX_ENV_https_proxy to push environment variables into the sandbox. Going to close this one as solved

rbren avatar May 11 '24 14:05 rbren

Thank you very much!

barsuna avatar May 14 '24 16:05 barsuna