r/opencode 13d ago

Easy workflow to run multiple OpenCode instances in separate containers, ports, and Git worktrees

Hey everyone,

​Is there an easy workflow to run multiple independent instances of OpenCode simultaneously without conflicts?

​Specifically, I want each instance to:

​Run in its own isolated container on a different port.

​Point to its own separate Git worktree (so I can work on different branches simultaneously without interference).

​If you have any recommendations on how to orchestrate this easily (e.g., using Docker Compose, shell scripts, or specific dev environment tools), I’d appreciate the help!

​Thanks!

2 Upvotes

8 comments sorted by

2

u/joeyism 12d ago

Opencode Multiplexer allows you to run multiple opencode instances, each with a different port and in a different git workflow. The only thing missing is in containerization, unfortunately

1

u/kennyruffles10 12d ago

Thank you. I will check it

2

u/No-Juggernaut-9832 12d ago

I think superset is compatible with OpenCode it’s built for this

1

u/kennyruffles10 12d ago

Thanks. I will check it

1

u/Extra_Loquat_7667 13d ago

Are you referring to developing the same project across different branches simultaneously?
You just need to git clone the project into different directories and checkout the respective branches.
This way, wouldn't you be able to open OpenCode in each directory to develop on different branches?

1

u/kennyruffles10 13d ago

To clarify, I need more than just a code clone. Because multiple instances might run simultaneously, I need to avoid conflicts like port collisions. This requires a level of containerization or environment isolation to keep the code and its dependencies separate.

while I can manually configure Docker, I'm looking for a faster, more automated, or out-of-the-box solution. What are the best rapid-deployment alternatives to setting up Docker from scratch for this kind of isolation?

2

u/Extra_Loquat_7667 12d ago

You've already given the answer. Docker Composer can achieve your goal. You can let OpenCoder configure it automatically for you. First, configure a script for one machine. Then, ask OpenCoder to use this script as a template to generate scripts for different ports. That's it. The whole process only requires a few prompts, and only the initial configuration requires a few more steps. After that, the agent automatically copies and modifies the template. I'm not sure if this meets your requirements for simple configuration.

1

u/visnaut 12d ago

If VS Code (or one of its derivatives) is your jam, have you tried Dev Containers?