Expand description
Docker operations module
This module provides Docker container management functionality including:
- Docker client wrapper with connection handling
- Docker-specific error types
- Embedded Dockerfile for building the opencode image
- Progress reporting for build and pull operations
- Image build and pull operations
- Volume management for persistent storage
- Container lifecycle (create, start, stop, remove)
- Container exec for running commands inside containers
- User management operations (create, delete, lock/unlock users)
- Image update and rollback operations
Re-exports§
pub use progress::ProgressReporter;pub use image::build_image;pub use image::image_exists;pub use image::pull_image;pub use update::UpdateResult;pub use update::has_previous_image;pub use update::rollback_image;pub use update::update_image;pub use exec::exec_command;pub use exec::exec_command_exit_code;pub use exec::exec_command_with_stdin;pub use users::UserInfo;pub use users::create_user;pub use users::delete_user;pub use users::list_users;pub use users::lock_user;pub use users::set_user_password;pub use users::unlock_user;pub use users::user_exists;pub use volume::MOUNT_CONFIG;pub use volume::MOUNT_PROJECTS;pub use volume::MOUNT_SESSION;pub use volume::VOLUME_CONFIG;pub use volume::VOLUME_NAMES;pub use volume::VOLUME_PROJECTS;pub use volume::VOLUME_SESSION;pub use volume::ensure_volumes_exist;pub use volume::remove_all_volumes;pub use volume::remove_volume;pub use volume::volume_exists;pub use mount::MountError;pub use mount::ParsedMount;pub use mount::check_container_path_warning;pub use mount::validate_mount_path;pub use container::CONTAINER_NAME;pub use container::ContainerBindMount;pub use container::ContainerPorts;pub use container::OPENCODE_WEB_PORT;pub use container::container_exists;pub use container::container_is_running;pub use container::container_state;pub use container::create_container;pub use container::get_container_bind_mounts;pub use container::get_container_ports;pub use container::remove_container;pub use container::start_container;pub use container::stop_container;pub use state::ImageState;pub use state::clear_state;pub use state::get_state_path;pub use state::load_state;pub use state::save_state;
Modules§
- container
- Docker container lifecycle management
- exec
- Container exec wrapper for running commands in containers
- image
- Docker image build and pull operations
- mount
- Bind mount parsing and validation for container configuration.
- progress
- Progress reporting utilities for Docker operations
- state
- Image state tracking for provenance information
- update
- Docker image update and rollback operations
- users
- Container user management operations
- volume
- Docker volume management
Structs§
- Docker
Client - Docker client wrapper with connection handling
- Extended
Health Response - Extended health response including container stats
- Health
Response - Response from OpenCode’s /global/health endpoint
Enums§
- Docker
Error - Errors that can occur during Docker operations
- Health
Error - Errors that can occur during health checks
Constants§
- DEFAULT_
STOP_ TIMEOUT_ SECS - Default graceful shutdown timeout in seconds
- DOCKERFILE
- The Dockerfile for building the opencode-cloud-sandbox container image
- IMAGE_
NAME_ DOCKERHUB - Docker image name for Docker Hub (secondary registry)
- IMAGE_
NAME_ GHCR - Docker image name for GitHub Container Registry (primary registry)
- IMAGE_
TAG_ DEFAULT - Default image tag
- VERSION_
LABEL - Version label key in Docker image
Functions§
- check_
health - Check health by querying OpenCode’s /global/health endpoint
- check_
health_ extended - Check health with extended information including container stats
- get_
cli_ version - CLI version from Cargo.toml
- get_
image_ version - Get version from image label
- setup_
and_ start - Full setup: ensure volumes exist, create container if needed, start it
- stop_
service - Stop and optionally remove the opencode container
- versions_
compatible - Compare versions and determine if they match