From 05e07cc4490cbf1eedddd9f71c90830a617ca468 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Sat, 3 Jan 2026 23:35:40 -0300 Subject: [PATCH] dockerized: support ERE_DOCKER_NETWORK (#262) Signed-off-by: Ignacio Hagopian --- README.md | 1 + crates/dockerized/src/zkvm.rs | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c46d30..3f2b493 100644 --- a/README.md +++ b/README.md @@ -388,6 +388,7 @@ fn main() -> Result<(), Box> { | `ERE_IMAGE_REGISTRY` | Specifies docker image registry of the images. When specified, it will try to pull image from the registry and possibly skip building. | `` | | `ERE_FORCE_REBUILD_DOCKER_IMAGE` | Force to rebuild docker images locally even they exist, it also prevents pulling image from registry. | `false` | | `ERE_GPU_DEVICES` | Specifies which GPU devices to use when running Docker containers for GPU-enabled zkVMs. The value is passed to Docker's `--gpus` flag. | `all` | +| `ERE_DOCKER_NETWORK` | Specifies the Docker network being used (if any) so spawned `ere-server-*` containers will join that network. | `` | Example usage: diff --git a/crates/dockerized/src/zkvm.rs b/crates/dockerized/src/zkvm.rs index af55b4f..ea5fc1a 100644 --- a/crates/dockerized/src/zkvm.rs +++ b/crates/dockerized/src/zkvm.rs @@ -158,6 +158,14 @@ impl ServerContainer { .publish(port.to_string(), port.to_string()) .name(&name); + let docker_network = std::env::var("ERE_DOCKER_NETWORK").ok(); + let host = if let Some(ref network) = docker_network { + cmd = cmd.network(network); + name.as_str() + } else { + "127.0.0.1" + }; + // zkVM specific options cmd = match zkvm_kind { zkVMKind::Risc0 => cmd @@ -230,7 +238,7 @@ impl ServerContainer { &program.0, )?; - let endpoint = Url::parse(&format!("http://127.0.0.1:{port}")).unwrap(); + let endpoint = Url::parse(&format!("http://{host}:{port}")).unwrap(); let client = block_on(zkVMClient::new(endpoint))?; Ok(ServerContainer {