Overview
OpenPortal can run OpenCode in a Docker container while keeping the web UI as a host process. This provides:- Isolated OpenCode environment
- Consistent runtime across different systems
- Easy cleanup and management
- No need to install OpenCode locally
Prerequisites
1
Install Docker
Ensure Docker is installed and running on your system.Verify Docker installation:
2
Install Bun
OpenPortal requires Bun to run the web UI:
3
Install OpenPortal
Install OpenPortal globally:
You do NOT need to install OpenCode when using Docker mode - the container includes it.
Running with Docker
Start OpenCode + Web UI in Docker Mode
Use the--docker flag to run OpenCode in a container:
- Pull the OpenCode Docker image (if not already available)
- Create and start a container with your project directory mounted
- Start the web UI on the host
Start Only OpenCode Server in Docker
Docker Configuration
Default Docker Image
By default, OpenPortal uses:Custom Docker Image
You can specify a custom OpenCode Docker image using theOPENCODE_DOCKER_IMAGE environment variable:
Remote Docker Host
To connect to a remote Docker daemon, use theDOCKER_HOST environment variable:
CLI Options with Docker
All standard OpenPortal options work with Docker mode:Custom Ports
Custom Directory
Custom Instance Name
Hostname Binding
Managing Docker Instances
List Running Instances
Stop Docker Instances
- Stop the Docker container
- Remove the container (auto-cleanup)
- Stop the web UI process
Clean Up Stale Entries
Volume Mounts
OpenPortal automatically mounts your project directory into the container:Port Mapping
The OpenCode server port is exposed from the container:Container Lifecycle
Container Naming
Containers are automatically named:openportal-my-project-a1b2c3d4
Auto-Removal
Containers are created with theAutoRemove flag, meaning they’re automatically removed when stopped.
Container Logs
View container logs directly:Advanced Docker Usage
Multiple Projects
Run multiple projects simultaneously:Server-Only Mode with Docker
Run only the OpenCode server in Docker:- You want to use a different UI
- You’re integrating with external tools
- You only need the OpenCode API
Inspecting Containers
Environment Variables
OPENCODE_DOCKER_IMAGE
Specify the OpenCode Docker image to use:DOCKER_HOST
Specify the Docker daemon connection:DEBUG
Enable debug output for troubleshooting:Troubleshooting
Docker Image Pull Issues
If the image fails to pull:Container Won’t Start
Check container logs:Port Already in Use
Specify different ports:Volume Mount Errors
Ensure the path is absolute:Permission Issues
On Linux, ensure your user is in the docker group:Container Not Stopping
Manually stop and remove:Connection Refused
Verify the container is running and port is exposed:Benefits of Docker Mode
Isolation
- OpenCode runs in an isolated environment
- No interference with host system packages
- Clean separation of concerns
Consistency
- Same OpenCode version across all environments
- Reproducible builds and deployments
- Easy version management via image tags
Easy Cleanup
- Containers auto-remove when stopped
- No residual files on host system
- Simple instance management
No Local Installation
- No need to install OpenCode on host
- No dependency conflicts
- Works on any system with Docker
Next Steps
- Learn about local installation for non-Docker setups
- Explore remote server deployment with Tailscale
- Configure custom Docker images for your workflow