pub struct DockerConfig {
pub image: String,
pub work_dir: String,
pub setup_commands: Vec<String>,
pub environment: Vec<String>,
pub bind_mounts: Vec<String>,
pub network_disabled: bool,
pub container_name_prefix: String,
pub auto_start: bool,
pub auto_remove: bool,
}code only.Expand description
Configuration for the Docker executor.
§Example
use adk_code::DockerConfig;
let config = DockerConfig::python();
assert_eq!(config.image, "python:3.12-slim");
assert_eq!(config.work_dir, "/workspace");Fields§
§image: StringContainer image to use.
work_dir: StringWorking directory inside the container.
setup_commands: Vec<String>Setup commands to run after container creation (e.g., pip install).
environment: Vec<String>Extra environment variables to set in the container.
bind_mounts: Vec<String>Bind mounts in host:container[:ro] format.
network_disabled: boolWhether to disable network access.
container_name_prefix: StringContainer name prefix (a random suffix is appended).
auto_start: boolWhether to auto-start on first execute if not already running.
auto_remove: boolWhether to auto-stop and remove the container on drop.
Implementations§
Source§impl DockerConfig
impl DockerConfig
Sourcepub fn python() -> DockerConfig
pub fn python() -> DockerConfig
Python 3.12 preset.
Sourcepub fn node() -> DockerConfig
pub fn node() -> DockerConfig
Node.js 20 preset.
Sourcepub fn custom(image: impl Into<String>) -> DockerConfig
pub fn custom(image: impl Into<String>) -> DockerConfig
Custom image preset.
Sourcepub fn setup_command(self, cmd: impl Into<String>) -> DockerConfig
pub fn setup_command(self, cmd: impl Into<String>) -> DockerConfig
Add a setup command to run after container creation.
Sourcepub fn pip_install(self, packages: &[&str]) -> DockerConfig
pub fn pip_install(self, packages: &[&str]) -> DockerConfig
Add a pip install command for Python dependencies.
Sourcepub fn npm_install(self, packages: &[&str]) -> DockerConfig
pub fn npm_install(self, packages: &[&str]) -> DockerConfig
Add an npm install command for Node.js dependencies.
Sourcepub fn with_network(self) -> DockerConfig
pub fn with_network(self) -> DockerConfig
Enable network access (disabled by default).
Sourcepub fn bind_mount(self, mount: impl Into<String>) -> DockerConfig
pub fn bind_mount(self, mount: impl Into<String>) -> DockerConfig
Add a bind mount.
Sourcepub fn env(self, var: impl Into<String>) -> DockerConfig
pub fn env(self, var: impl Into<String>) -> DockerConfig
Add an environment variable.
Trait Implementations§
Source§impl Clone for DockerConfig
impl Clone for DockerConfig
Source§fn clone(&self) -> DockerConfig
fn clone(&self) -> DockerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more