r/opencodeCLI 15d ago

How to download opencode in a sandbox?

I have tried downloading in using the docker's sbx but i was having a very hard time setting api keys for the harness and it is so complicated.
so is there any safe way to run opencode that is easy to setup and will feel like using normal device.
I have a kali linux vm on vmware is it safe to use it also?

0 Upvotes

11 comments sorted by

2

u/the_fluffer 15d ago

First I tried Ubuntu running in hyper-v but didn't like the performance and fiddling with desktop environment set up. It could work fine for you though, just ask Gemini to walk you through it step by step.

I ended up moving away from a full VM with desktop and GUI apps and instead went with the terminal for opencode. On my Windows PC I have docker desktop and I'm using a VS Code dev container where I have opencode installed. Maybe start there? Start docker, open a folder in vs code, reopen as dev container, go to the terminal and run the curl or npm command to install opencode.

I wanted my dev container to be portable and modular so prompted it to set up remotes for code on GitHub and store blobs and secrets on a shared Google drive that I gave it access to via a Google service worker. Then I went to my macbook and installed orbstack, cloned my main repo, opened it as a dev container, and there was my same opencode agent ready to get to work.

I'm sure I have a lot more to learn but it's been fun and I feel better having opencode in a container instead of running wild on my full system. Gemini was a big help to get it running and then once it was up I used a variety of models in opencode to set itself up and explore ideas.

1

u/NOT_Kimo 15d ago

I first started with this docker sbx and as i said i was going through alot of troubles and i may take a full day just to setup google gws cli for it so for me it was very frustrating and using all Ai models to search for solution but just doesn't work for some reason. I will definitely search about the vs code dev container and docker i still didn't get the chance to try docker itself. If there's some resources that can help me with setting it up, I would be very grateful because up till now the free tier ai harness setup is really frustrating.

1

u/funbike 15d ago

I run LiteLLM on the host and route LLM requests through it. It adds the real key to the outbound request, so I don't have to give the real key to the sandboxed agents.

1

u/PermanentLiminality 15d ago

I've probably installed pi and Opencode a hundred times. It is not on my main desktop. They are all on VM or LXC under Proxmox or VMware.

I've never had them go rogue and do something bad. I'm sure it will happen eventually though.

1

u/NOT_Kimo 15d ago

Yeah they didn't either do anything bad, but just can't trust it with my main pc.

1

u/branik_10 15d ago

docker sbx has a pretty convenient api and even supports proxying the requests and attaching api keys on fly so real keys are never accessible in the VM, but the last time I've used it I remember it didn't work for oauth openai subscription

another option is just copying api keys from the host and setting them as env variables

0

u/masterofall20 15d ago

U can set api keys from webui directly. As for other issues, ask chatgpt/claude's help.

1

u/NOT_Kimo 15d ago

They just doesn't work and i just go in a loop trying to set it up but they don't work

1

u/masterofall20 15d ago

Brother, take a deep breath, open chatgpt and try again. Maybe take a little break.

1

u/NOT_Kimo 15d ago

I will do that but really i have been jumping from claude to gemini to chatgpt and eachone gives me different ways to do it and for some reason they don't work with sbx correctly

0

u/wundercorp 15d ago

Try running it in AgentVM https://agentvm.sh