Skip to main content

create_container

Function create_container 

Source
pub async fn create_container(
    client: &DockerClient,
    name: Option<&str>,
    image: Option<&str>,
    opencode_web_port: Option<u16>,
    env_vars: Option<Vec<String>>,
    bind_address: Option<&str>,
    cockpit_port: Option<u16>,
    cockpit_enabled: Option<bool>,
    bind_mounts: Option<Vec<ParsedMount>>,
) -> Result<String, DockerError>
Expand description

Create the opencode container with volume mounts

Does not start the container - use start_container after creation. Returns the container ID on success.

§Arguments

  • client - Docker client
  • name - Container name (defaults to CONTAINER_NAME)
  • image - Image to use (defaults to IMAGE_NAME_GHCR:IMAGE_TAG_DEFAULT)
  • opencode_web_port - Port to bind on host for opencode web UI (defaults to OPENCODE_WEB_PORT)
  • env_vars - Additional environment variables (optional)
  • bind_address - IP address to bind on host (defaults to “127.0.0.1”)
  • cockpit_port - Port to bind on host for Cockpit (defaults to 9090)
  • cockpit_enabled - Whether to enable Cockpit port mapping (defaults to true)
  • bind_mounts - User-defined bind mounts from config and CLI flags (optional)