Skip to content

Commit 3e679db

Browse files
committed
fix(launcher): reuse MPC container across restarts to preserve logs
The launcher removed and recreated the MPC container on every boot (docker rm -f + docker compose up -d), dropping Docker's container-ID-keyed logs each restart. The rm -f worked around a name conflict from running as a different compose project every boot (random temp compose path, no -p). Pass an explicit `-p mpc` compose project so Compose reuses the existing container when the config is unchanged (preserving its logs) and recreates it only when the rendered config changes (e.g. image digest). No name-conflict cleanup is needed: a launcher change re-keys the CVM disk (the key is derived from the launcher's compose measurement), so a new launcher always boots on a fresh disk with no prior mpc-node container. Also note in the TDX guide that logs persist across a restart but are cleared on an upgrade.
1 parent 5b2e62b commit 3e679db

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

crates/tee-launcher/src/compose.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,11 @@ 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+
// Use a stable compose project (`-p`) so the container is reused across
63+
// restarts rather than recreated, preserving its logs. Compose
64+
// recreates it only when the rendered config (e.g. image digest) changes.
6765
let run_output = Command::new("docker")
68-
.args(["compose", "-f", &compose_path, "up", "-d"])
66+
.args(["compose", "-p", "mpc", "-f", &compose_path, "up", "-d"])
6967
.output()
7068
.map_err(|inner| LauncherError::DockerRunFailed {
7169
image_hash: manifest_digest.clone(),

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)