Skip to content

Commit fdeefd5

Browse files
authored
fix(launcher): reuse MPC container across restarts to preserve logs (#3705)
1 parent afb2c9b commit fdeefd5

4 files changed

Lines changed: 27 additions & 5 deletions

File tree

crates/tee-launcher/assets/mpc-node-docker-compose.tee.template.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: mpc-node
2+
13
services:
24
mpc-node:
35
image: "{{IMAGE_NAME}}@{{MANIFEST_DIGEST}}"

crates/tee-launcher/assets/mpc-node-docker-compose.template.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: mpc-node
2+
13
services:
24
mpc-node:
35
image: "{{IMAGE_NAME}}@{{MANIFEST_DIGEST}}"

crates/tee-launcher/src/compose.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,10 @@ pub fn launch_mpc_container(
5959
let compose_file = render_compose_file(platform, port_mappings, image_name, manifest_digest)?;
6060
let compose_path = compose_file.path().display().to_string();
6161

62-
// Remove any existing container from a previous run (by name, independent of compose file)
63-
let _ = Command::new("docker")
64-
.args(["rm", "-f", MPC_CONTAINER_NAME])
65-
.output();
66-
62+
// The compose file pins a stable top-level project `name`, so the
63+
// container is reused across restarts rather than recreated, preserving its
64+
// logs. Compose recreates it only when the rendered config (e.g. image
65+
// digest) changes.
6766
let run_output = Command::new("docker")
6867
.args(["compose", "-f", &compose_path, "up", "-d"])
6968
.output()
@@ -265,4 +264,19 @@ mod tests {
265264
// then
266265
assert!(!rendered.contains("environment:"));
267266
}
267+
268+
#[test]
269+
fn includes_stable_project_name() {
270+
// given
271+
let port_mappings = empty_port_mappings();
272+
let digest = sample_digest();
273+
274+
// when
275+
let rendered = render(Platform::Tee, &port_mappings, &digest);
276+
277+
// then — a stable top-level project name keeps Compose reusing the
278+
// container across restarts instead of recreating it (which would wipe
279+
// its logs)
280+
assert!(rendered.contains("name: mpc-node"));
281+
}
268282
}

docs/running-an-mpc-node-in-tdx-external-guide.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,10 @@ Full flag reference and `.env` field-by-field documentation:
966966
Dstack provides a dedicated web page to view CVM information, including links to the Docker logs.
967967
More details can be found in [Phala's guide](https://github.com/Dstack-TEE/dstack?tab=readme-ov-file#deploy-an-app).
968968
969+
> **Log retention:** the MPC container is reused across **restarts**, so its
970+
> logs are preserved and remain viewable here after a restart. An **upgrade**
971+
> (new image) recreates the container, which clears its logs.
972+
969973
---
970974
971975
#### Local Access

0 commit comments

Comments
 (0)