Global Options
These options work with all commands unless otherwise noted.-h, —help
Display help information and exit.boolean
default:"false"
Show help message with usage, commands, and examples
-h
- Displays help text and exits
- Overrides all other commands and options
- Works from any directory
-d, —directory
Specify the working directory for the OpenCode instance.string
default:"current directory"
Absolute or relative path to the project directory
-d
process.cwd())
Behavior:
- Path is resolved to absolute path
- Used as the working directory for OpenCode server
- Used to identify instances (one instance per directory)
- Directory basename becomes default instance name
- In Docker mode, directory is mounted into the container at the same path
-p, —port
Specify the port for the Web UI server.number
default:"3000"
Port number for the Web UI (1-65535)
-p
3000 (or next available port)
Behavior:
- If port is not specified, OpenPortal attempts to use port 3000
- If port 3000 is in use, automatically finds the next available port
- If port is explicitly specified but unavailable, OpenPortal will fail
- Only applicable to default command (not
runcommand) - Port is bound to the hostname specified by
--hostname
The
run command does not start a Web UI, so the --port option is ignored for that command.—opencode-port
Specify the port for the OpenCode server.number
default:"4000"
Port number for the OpenCode API server (1-65535)
4000 (or next available port)
Behavior:
- If port is not specified, OpenPortal attempts to use port 4000
- If port 4000 is in use, automatically finds the next available port
- If port is explicitly specified but unavailable, OpenPortal will fail
- Port is bound to the hostname specified by
--hostname - In Docker mode, port is mapped from container to host
—hostname
Specify the hostname or IP address to bind servers to.string
default:"0.0.0.0"
Hostname or IP address for server binding
0.0.0.0
Common Values:
0.0.0.0- Bind to all network interfaces (accessible from network)127.0.0.1- Bind to localhost only (local access only)- Specific IP - Bind to specific network interface
- Both OpenCode server and Web UI bind to this hostname
- In Docker mode, the container binds to
0.0.0.0internally, but port mapping uses the specified hostname - Display URLs use
localhostwhen hostname is0.0.0.0
—name
Specify a custom name for the instance.string
default:"directory basename"
Custom name to identify the instance
my-project from /path/to/my-project)
Behavior:
- Used to identify instances in
openportal listoutput - Used in Docker container names:
openportal-{name}-{random-id} - Helpful when running multiple instances
- Can be used with
openportal stop --nameto stop specific instance
—docker
Run OpenCode in a Docker container instead of as a local process.boolean
default:"false"
Enable Docker mode for OpenCode server
false (process mode)
Behavior:
- OpenCode runs in a Docker container
- Web UI still runs as a local process (default command only)
- Working directory is mounted into container
- Container uses image specified by
OPENCODE_DOCKER_IMAGEenvironment variable - Container is created with
AutoRemove: truefor automatic cleanup - Validates mount path for security (prevents mounting system directories)
- If image doesn’t exist locally, automatically pulls from registry
- Docker daemon must be running
- Docker socket accessible (
/var/run/docker.sockon Unix,//./pipe/docker_engineon Windows) - Working directory must be an absolute path
- Working directory cannot be a sensitive system directory
ghcr.io/anomalyco/opencode:1.1.3
Customize with environment variable:
Option Combinations
All Options Together
Common Patterns
Local development:Environment Variables
In addition to command-line options, OpenPortal supports environment variables:OPENCODE_DOCKER_IMAGE
string
default:"ghcr.io/anomalyco/opencode:1.1.3"
Docker image to use when running in Docker mode
DOCKER_HOST
string
default:"platform-specific"
Docker daemon connection string
unix:///var/run/docker.sock- Unix sockettcp://localhost:2375- TCP connectionnpipe:////./pipe/docker_engine- Windows named pipe
- Unix/Linux/macOS:
/var/run/docker.sock - Windows:
//./pipe/docker_engine
DEBUG
boolean
default:"false"
Enable debug logging for Docker operations
Option Parsing Rules
Long Options
Short Options
Boolean Flags
Multiple Options
Directory as Argument
Command-Specific Option Availability
Default Command
Supports all options:-h, --help-d, --directory-p, --port--opencode-port--hostname--name--docker
run Command
Supports:-h, --help-d, --directory--opencode-port(not--port)--hostname--name--docker
stop Command
Supports:-h, --help-d, --directory--name
list / ls Command
Supports:-h, --help
clean Command
Supports:-h, --help